Skip to content

Instantly share code, notes, and snippets.

View olegopro's full-sized avatar
🇷🇺

Oleg Desyatnikov olegopro

🇷🇺
View GitHub Profile

Итераторы типов в TypeScript

В TypeScript существуют конструкции, которые работают аналогично итераторам в обычных языках программирования, но оперируют с типами во время компиляции. Эти "итераторы типов" позволяют трансформировать типы и создавать мощные абстракции на уровне типовой системы.

Содержание

@olegopro
olegopro / extract_unique_domains_from_har.php
Created January 16, 2025 16:19
Извлечение уникальных доменов из файла .har с помощью PHP
<?php
// Путь к вашему файлу .har
$filePath = '/Users/evilgazz/Desktop/chat.mistral.ai.har';
// Загрузите содержимое файла .har
$harContent = file_get_contents($filePath);
// Декодируйте JSON
$harData = json_decode($harContent, true);
@olegopro
olegopro / draw_tree.php
Created December 19, 2023 19:54
Скрипт на PHP предназначен для создания текстового представления структуры директорий файловой системы. Он просматривает указанную директорию и все её поддиректории, генерируя список файлов и папок в виде дерева. Вывод этого списка происходит в виде иерархического дерева с символами, указывающими на вложенность.
<?php
function drawTree($directory, $prefix = '')
{
$files = array_diff(scandir($directory), array('.', '..'));
$totalFiles = count($files);
$fileCount = 0;
$output = '';
@olegopro
olegopro / exceptions-tree.php
Created May 30, 2023 11:42 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@olegopro
olegopro / sass-aspect-ratio-with-fallback.scss
Created October 12, 2022 20:46 — forked from knolaust/sass-aspect-ratio-with-fallback.scss
Sass Mixin For CSS Aspect-Ratio With Fallback
/**
* Include this Sass mixin for aspect-ratio. Includes fallback
* for browsers that do not support aspect-ratio. This fallback is really not necessary at this point unless
* a specific browser you need to support.
*
* Usage:
* @include aspect-ratio(16,9);
* creates a 16x9 container using aspect-ratio for supported browsers with fallback for browsers that do not.
*
* Codepen Example: https://codepen.io/knolaust/pen/KKZwXjv
<script>
function loadStyle(url){
let link = document.createElement('link');
link.href = url;
link.rel = 'stylesheet';
document.body.appendChild(link);
}
loadStyle('css/async.css');
</script>