Skip to content

Instantly share code, notes, and snippets.

View orottier's full-sized avatar

Otto Rottier orottier

View GitHub Profile
@orottier
orottier / .php_cs
Created October 3, 2017 13:03
PHP-CS-Fixer settings
<?php
// vim: set ft=php:
$finder = PhpCsFixer\Finder::create()
->exclude('bootstrap')
->exclude('node_modules')
->exclude('public')
->exclude('resources')
->exclude('storage')
->exclude('vendor')
@orottier
orottier / RetryTest.php
Last active July 21, 2023 10:10
Retry function for PHP with exponential backoff
<?php
class RetryTest extends TestCase
{
public function setUp()
{
parent::setUp();
// abuse superglobal to keep track of state
$_GET['a'] = 0;
}
@orottier
orottier / countries.json
Created August 23, 2016 14:43 — forked from stefanbauer/countries.json
A list of countries with additional data
[
{
"name": "Afghanistan",
"capital": "Kabul",
"altSpellings": [
"AF",
"Afġānistān"
],
"relevance": "0",
"region": "Asia",
@orottier
orottier / pre-commit.sh
Last active November 12, 2015 18:07
Pre Commit hook, proper stashing with unstash using bash traps (in case of errors halfway)
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
git stash -u --keep-index
trap "git stash pop --quiet --index; exit 1" SIGINT SIGTERM
@orottier
orottier / TrackChanges.php
Created November 5, 2015 11:32
Laravel, store changes on your models: TrackChanges Trait
<?php
namespace App\Traits;
use Auth;
use App\Models\Change;
trait TrackChanges
{
public static function bootTrackChanges()