Skip to content

Instantly share code, notes, and snippets.

View WinterSilence's full-sized avatar
🙃
explore

Anton WinterSilence

🙃
explore
View GitHub Profile
@WinterSilence
WinterSilence / fn_map_list.scss
Last active December 8, 2021 05:53
SASS functions: merge-maps(), merge-lists(), get()
/// Merges maps or|and lists (optional).
///
/// @param {map | list} $map1 The first map
/// @param {map | list} $map2 The second map
/// @param {bool} $merge-lists Allow merge lists
/// @return {map | null} The new map or list or null at error
@function merge-maps($map1, $map2, $merge-lists: false) {
@if (type-of($map1) == map or (type-of($map1) == list and length($map1) == 0)) and (type-of($map2) == map or (type-of($map2) == list and length($map2) == 0)) {
$result: $map1;
@each $key, $value in $map2 {
@WinterSilence
WinterSilence / greaseMonkeyScript.js
Last active November 30, 2021 01:06
YandexInvest, Яндекс Инвестиции, Добавляет стоимость за 1 акцию в истории операций
// ==UserScript==
// @name YandexInvest
// @namespace YandexInvest
// @version 1.1.0
// @description Extend history pages on https://invest.yandex.ru
// @author info@ensostudio.ru
// @include https://invest.yandex.ru/*/history/
// @require https://code.jquery.com/jquery-3.4.1.slim.min.js
// @grant unsafeWindow
// @run-at document-end
@WinterSilence
WinterSilence / EnsoStudio\ReflectionFile.php
Last active November 30, 2021 01:03
The reflection class reports information about a PHP7 file. Collects functions, interfaces, classes, traits with his constants, properties, methods.
<?php
namespace EnsoStudio;
use Reflector;
use Reflection;
use ReflectionClass;
use ReflectionType;
use ReflectionNamedType;
use ReflectionFunctionAbstract;
@WinterSilence
WinterSilence / polyfill_getallheaders.php
Last active October 29, 2021 16:32
Polyfill for PHP function getallheaders() (alias apache_request_headers())
<?php
if (!\function_exists('getallheaders')) {
/**
* Returns HTTP headers for the server request.
*
* @return string[] The HTTP headers
*/
function getallheaders()
{
@WinterSilence
WinterSilence / VarDumper.php
Created October 20, 2021 12:04
Extended Yii 2 class `VarDumper`
<?php
namespace yii\helpers;
use Closure;
use ReflectionFunction;
use Throwable;
use Traversable;
use yii\base\Arrayable;
@WinterSilence
WinterSilence / Collection.php
Last active October 10, 2021 03:53
Yii2 Collection
<?php
namespace app\core;
use ArrayAccess;
use Closure;
use Countable;
use Iterator;
use IteratorAggregate;
use yii\base\ArrayAccessTrait;
@WinterSilence
WinterSilence / GlobStreamWrapper.php
Last active October 5, 2021 06:14
glob:// stream wrapper
<?php
/**
* Stream wrapper `glob://` to use rich syntax in `GlobIterator`.
*/
class GlobStreamWrapper
{
/**
* @var string
*/
@WinterSilence
WinterSilence / arrayToXml.php
Last active August 7, 2021 02:15
PHP function for convert array to SimpleXMLElement object
<?php
namespace Enso;
use SimpleXMLElement;
/**
* Converts array to XML object.
* Note: attribute keys must prefix '@'.
*
@WinterSilence
WinterSilence / Cookie.php
Last active July 14, 2021 03:56
Class Enso\Http\Cookie -helper for work with HTTP cookies
@WinterSilence
WinterSilence / Enso\Core\Route.php
Last active February 1, 2021 14:54
KF7\Routing classes
<?php
/**
* @link https://kf7.github.io
* @copyright (c) 2006-2020 Kohana team
* @license https://kf7.github.io/license/ BSD-3-Clause
*/
declare(strict_types=1);
namespace KF7\System\Http\Routing;