Skip to content

Instantly share code, notes, and snippets.

View WinterSilence's full-sized avatar
🙃
explore

Anton WinterSilence

🙃
explore
View GitHub Profile
@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 / PhpTokenIterator.php
Last active August 30, 2022 19:13
Extended PhpToken with more `is*` methods + iterator
<?php
namespace EnsoStudio\PhpTokenizer;
use ArrayIterator;
use FilterIterator;
use SeekableIterator;
use OutOfBoundsException;
use PhpToken;
@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 / Cookie.php
Last active July 14, 2021 03:56
Class Enso\Http\Cookie -helper for work with HTTP cookies
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS template</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
</head>
<body>
<main id="main"></main>
@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 / Controller_CRUD.php
Last active May 6, 2020 14:36
Kohana/Koseven/KO7 CRUD controller
<?php
/**
* CRUD controller.
*
* @link https://en.wikipedia.org/wiki/Create,_read,_update_and_delete CRUD
* @link https://koseven.dev/documentation/kohana/tutorials/basic-controller Controller_Base
*/
class Controller_CRUD extends Controller_Base
{
/**
@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 / iana_languages.php
Last active February 22, 2020 23:10
PHP function: returns language list parsed from site "iana.org"
<?php
/**
* Returns language list parsed from site "iana.org" and grouped by type ('language', 'variant', 'extlang' and etc.).
*
* @param int $last_update timestamp (optional)
* @param string $url source URL (optional)
* @return array|null return NULL when list not updated
*/
function iana_languages(int $last_update = null, string $url = null): ?array
{
@WinterSilence
WinterSilence / litresCoupons.js
Created August 19, 2019 01:43
Greasemonkey/Tampermonkey script: multi add coupons to litres.ru
// ==UserScript==
// @name litresCoupons
// @namespace litres.ru
// @version 0.1
// @description Add coupons
// @author info@ensostudio.ru
// @include https://www.litres.ru/pages/put_money_on_account/*
// @include https://litres.ru/pages/put_money_on_account/*
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @grant unsafeWindow