This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function sessionDetails(Request $request, DeviceRunSession $session): JsonResponse | |
| { | |
| $validated = $request->validate([ | |
| 'device_id' => 'required|integer|exists:hkl_devices,id', | |
| ]); | |
| if ($session->device_id !== (int) $validated['device_id']) { | |
| abort(404); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const user = { | |
| age: 22, | |
| gender: 'male', | |
| address: { | |
| city: 'Kyiv' | |
| } | |
| } | |
| // Copying objects | |
| const user2 = user; // assignment of reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (() => { | |
| '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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Преобразование количества "цифрой" в количество "словом" | |
| * Чтобы было удобнее формировать массивы со склонениями, запомните ряд чисел 1-2-5, | |
| * а потом мысленно подставляйте их в массив: (один "рубль", два "рубля", пять "рублей") | |
| * $num = 3; | |
| * $words = array('новость', 'новости', 'новостей'); | |
| * echo $num . ' ' . num_2_word($num, $words); // сколько новостей | |
| * | |
| * @param $n | |
| * @param $words |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.9-alpine | |
| RUN mkdir /app | |
| WORKDIR /app | |
| COPY . /app | |
| CMD ["python", "app.py"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class BladeServiceProvider extends ServiceProvider | |
| { | |
| public function boot(): void | |
| { | |
| Form::component('bsText', 'collective.form.text', [ | |
| 'label', 'name', 'value' => null, 'attributes' => [] | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\ReadModel\Blog; | |
| use Doctrine\DBAL\Connection; | |
| use Doctrine\DBAL\Exception; | |
| class PostFetcher | |
| { | |
| public function __construct( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $v = \DB::select("select version()")[0]->{"version()"}; | |
| $v = explode('-', $v)[0]; |
NewerOlder