Add code in a file:
\DB::enableQueryLog();
$user = App\User::get();
function greet(person: string, date: Date): void { | |
console.log(`Hello, ${person}! Today is ${date.toDateString()}.`); | |
} | |
const getFullName = (first: string, last?: string): string => | |
last ? `${first} ${last}` : `${first}`; | |
let fullName = getFullName("John"); | |
greet(fullName, new Date()); |
const user = { | |
age: 22, | |
gender: 'male', | |
address: { | |
city: 'Kyiv' | |
} | |
} | |
// Copying objects | |
const user2 = user; // assignment of reference |
(() => { | |
'use strict'; | |
// Функция для работы с localStorage | |
const getStoredValue = (key, defaultValue) => localStorage.getItem(key) || defaultValue; | |
const setStoredValue = (key, value) => localStorage.setItem(key, value); | |
// Функции для установки фронт-темы и фронт-иконки | |
const setFrontTheme = theme => document.documentElement.setAttribute('data-bs-theme', theme); | |
const setFrontThemeIcon = themeIcon => document.querySelector('#themeIcon').setAttribute('xlink:href', themeIcon); |
/** | |
* Преобразование количества "цифрой" в количество "словом" | |
* Чтобы было удобнее формировать массивы со склонениями, запомните ряд чисел 1-2-5, | |
* а потом мысленно подставляйте их в массив: (один "рубль", два "рубля", пять "рублей") | |
* $num = 3; | |
* $words = array('новость', 'новости', 'новостей'); | |
* echo $num . ' ' . num_2_word($num, $words); // сколько новостей | |
* | |
* @param $n | |
* @param $words |
FROM python:3.9-alpine | |
RUN mkdir /app | |
WORKDIR /app | |
COPY . /app | |
CMD ["python", "app.py"] |
<?php | |
class BladeServiceProvider extends ServiceProvider | |
{ | |
public function boot(): void | |
{ | |
Form::component('bsText', 'collective.form.text', [ | |
'label', 'name', 'value' => null, 'attributes' => [] | |
]); |
<?php | |
namespace App\ReadModel\Blog; | |
use Doctrine\DBAL\Connection; | |
use Doctrine\DBAL\Exception; | |
class PostFetcher | |
{ | |
public function __construct( |
<?php | |
namespace App\Controller\Admin; | |
use Doctrine\ORM\EntityManagerInterface; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Annotation\Route; |
<?php | |
$v = \DB::select("select version()")[0]->{"version()"}; | |
$v = explode('-', $v)[0]; |