View phpunit_array_assertions.php
public static function assertArrayStructure($keys, $array)
{
$arrayKeys = array_keys($array);
$missing = array_diff($keys, $arrayKeys);
$unexpected = array_diff($arrayKeys, $keys);
$message = 'Keys are wrong.';
if ($missing !== []) {
$message .= ' Missing: ' . implode(', ', $missing) . '.';
View Sam Dark.icls
<scheme name="Sam Dark" version="142" parent_scheme="Default">
<option name="LINE_SPACING" value="1.05" />
<option name="EDITOR_FONT_SIZE" value="15" />
<option name="EDITOR_LIGATURES" value="true" />
<option name="CONSOLE_FONT_NAME" value="Monospaced" />
<option name="CONSOLE_FONT_SIZE" value="13" />
<option name="EDITOR_FONT_NAME" value="Fira Code" />
<colors>
<option name="WHITESPACES" value="f2f2f2" />
</colors>
View squash-merge.sh
git checkout -b local-branch-name master
git pull https://github.com/username/repo.git remote-branch-name
git --no-pager show -s --format='%an <%ae>' FETCH_HEAD
git merge --squash local-branch-name
git commit -am 'commit message' --author="author name <email@example.com>"
git push origin master
View routing.php
// Laravel
Route::get('user/{id}', 'UserController@showProfile');
// Yii
'user/<id>' => 'user/profile',
View unhash.js
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('');
}
View gist:54764dd69b3e38140938
git reset --soft HEAD~3
git commit -m 'new commit message'
View keybase.md

Keybase proof

I hereby claim:

  • I am samdark on github.
  • I am samdark (https://keybase.io/samdark) on keybase.
  • I have a public key whose fingerprint is 22C9 A490 0E05 7C30 6A9D C678 F1AE 38B2 A108 39BF

To claim this, I am signing this object:

View books.md

Распродаю свою книжную полку

  • Регулярные выражения, Дж. Фридл, 3-е издание

  • Разгони свой сайт, Н. Мациевский

  • Самоучитель Java 2, Ильдар Хабибуллин

  • Применение UML 2.0 и шаблонов проектирования, К. Ларман

  • CNE 050-63 Network Technologies

  • ActionScript, Шэм Бангал

View DuplicateFilter.php
<?php
/**
* DuplicateFilter prevents Yii from exposing URLs starting with /index.php/ when showScriptName is false. Such
* URLs are automatically redirected to proper ones.
*
* To use add the following to your controller:
*
* ```php
* public function filters() {
* return array(
View join_vs_in.php
<?php
$db = new PDO('mysql:host=localhost;dbname=rmc2', 'root');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function benchmark($callback){
$start = microtime(true);
for ($i = 0; $i < 100; $i++)
$callback();
return microtime(true) - $start;
}