Skip to content

Instantly share code, notes, and snippets.

View samdark's full-sized avatar
🛠️
Improving everything

Alexander Makarov samdark

🛠️
Improving everything
View GitHub Profile
@samdark
samdark / how_php_environment_variables_actually_work.md
Last active January 5, 2024 07:15
How PHP Environment Variables Actually work
@samdark
samdark / the_ministry.md
Created April 22, 2023 07:13
The ministry

The ministry

Humanity had finally succeeded in its mission to destroy the planet. The last tree had been felled, the final river had run dry, and the earth was now a barren wasteland. But as they stood at the edge of the abyss, a strange thing happened.

As they began to plant new trees, the barren earth suddenly began to thrive. The soil was now rich with nutrients, and the trees grew at an unprecedented rate. Birds returned, and animals appeared out of nowhere. The planet was now more vibrant and alive than it had ever been.

Confused by this paradoxical turn of events, humanity searched for an explanation. Had they been wrong about the effects of their actions? Or was this some sort of cosmic joke?

As they pondered this strange turn of events, they realized the truth: their destruction had inadvertently created the conditions for new life to emerge. It was a paradoxical twist that they could never have predicted.

@samdark
samdark / git_distinct_author.sh
Created August 16, 2021 20:43
How many distinct authors worked on the repository in a given timeframe
git shortlog -s --group=author --group=trailer:co-authored-by --since=2012.01.01 --until=2013.01.01 | wc -l
@samdark
samdark / about.md
Last active July 14, 2021 13:11 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@samdark
samdark / yii3flood.md
Created May 23, 2021 21:54
yii3flood.md
@samdark
samdark / gist:54764dd69b3e38140938
Created June 29, 2014 21:42
Git: squash last 3 commits together
git reset --soft HEAD~3
git commit -m 'new commit message'
@samdark
samdark / ClearAssetsCommand.php
Created April 5, 2013 10:14
Yii command to clear assets
<?php
/**
* Clear assets Command
*
* Deletes all published assets.
*
* Usage:
* yiic clearassets
*
* @author Alexander Makarov
function unhash(hash) {
var parts = [];
var letters = 'acdegilmnoprstuw';
while (hash !== 7) {
var index = hash % 37;
hash = (hash - index) / 37;
parts.unshift(letters[index]);
}
return parts.join('');
}
@samdark
samdark / timestamp_refactoring.php
Created April 8, 2020 13:00
Timsetamp case refactoring
<?php
// see https://gist.github.com/Nex-Otaku/622ce7f2f336f27b4953e85efffa7c45
class Timestamp
{
private int $intTimestamp;
private function __construct(int $intTimestamp)
{

master

PhpBench @git_tag@. Running benchmarks. Using configuration file: D:\dev\yii-dev\dev\di/phpbench.json

\Yiisoft\Di\Tests\Benchmark\ContainerBench

benchConstructStupid....................I4 [μ Mo]/r: 438.566 435.190 (μs) [μSD μRSD]/r: 9.080μs 2.07%
benchConstructSmart.....................I4 [μ Mo]/r: 470.958 468.942 (μs) [μSD μRSD]/r: 2.848μs 0.60%

benchSequentialLookups # 0..............R5 I4 [μ Mo]/r: 2,837.000 2,821.636 (μs) [μSD μRSD]/r: 34.123μs 1.20%