Skip to content

Instantly share code, notes, and snippets.

View WinterSilence's full-sized avatar
🙃
explore

Anton WinterSilence

🙃
explore
View GitHub Profile
{
"data": [
{
"id": "1",
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421"
@WinterSilence
WinterSilence / input.scss
Created April 1, 2022 09:26
Generated by SassMeister.com.
@import "normalize";
.btn, %btn {
box-sizing: border-box;
border: 1px gray solid;
border-radius: .25rem;
padding: .5rem 1rem;
}
.text-white, %text-white {
color: #fff;
}
@WinterSilence
WinterSilence / Tag.php
Last active January 14, 2022 15:41
Extended DOMElement for generate HTML tags
<?php
/**
* HTML tag.
*/
class Tag extends DOMElement implements TagInterface
{
public function __construct(string $name, string $value = '')
{
parent::__construct($name, $value);
@WinterSilence
WinterSilence / _font-face.mixin.scss
Last active December 20, 2021 03:31
SCSS/SASS mixin `@font-face`
$font-dir: null !default;
///
/// Returns font format.
///
/// @param {string} $src The font filename
/// @return {string}
///
@function font-format($src) {
$formats: (
@WinterSilence
WinterSilence / _substr.scss
Created December 9, 2021 11:56
SCSS/SASS port of PHP function substr()
/// Returns part of string.
/// Similar to PHP `substr()`: `substr("abc", 2, 1)` - "c", `substr("abc", 1)` - "bc", `substr("abcd", -3, -1)` - "bc".
///
/// @param {String} $str The input string
/// @param {Number} $offset The returned string will start at the offset'th position in string, counting from zero
/// @param {Number} $length The string returned will contain at most length characters beginning from offset (optional)
/// @return {String}
/// @see https://www.php.net/manual/en/function.substr
@function substr($str, $offset, $length: 0) {
$length: if($length < 0, $length - 1, if($length == 0, str-length($str), $length));
@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 / yii\helpers\AppHelper.php
Last active July 4, 2022 00:11
Yii2 application reflection
<?php
namespace yii\helpers;
use ReflectionClass;
use ReflectionMethod;
use Yii;
use yii\base\Action;
use yii\base\Application;
use yii\base\Behavior;
@WinterSilence
WinterSilence / findOutdatedDocTranslations.php
Last active July 7, 2022 23:37
Find outdated documentation translations for Yii 2
<?php
/**
* @param int $pr Identifier of Pull Request
* @param string $repoDir Base directory of repository
* @param string $package "{owner}/{repo}"
* @param string $docDir Repository directory of documentation
* @return array Files to update
*/
function findOutdatedDocTranslations($pr, $repoDir, $package = 'yiisoft/yii2', $docDir = 'docs')