This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\commands; | |
trait ProgressionBarOutput | |
{ | |
public function runProcess(\Countable $countable, callable $callback) | |
{ | |
$bar = $this->output->createProgressBar(count($countable)); | |
$bar->start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return PhpCsFixer\Config::create() | |
->setRules(array( | |
'@PSR2' => true, | |
'binary_operator_spaces' => true, | |
'blank_line_after_namespace' => true, | |
'blank_line_after_opening_tag' => true, | |
'blank_line_before_return' => true, | |
'braces' => true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Errors { | |
/** | |
* Create a new Errors instance. | |
*/ | |
constructor() { | |
this.errors = {}; | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event { | |
constructor() { | |
this.vue = new Vue(); | |
} | |
fire(event, data = null) { | |
this.vue.$emit(event, data); | |
} | |
listen(event, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event { | |
constructor() { | |
this.vue = new Vue(); | |
} | |
fire(event, data = null) { | |
this.vue.$emit(event, data); | |
} | |
listen(event, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regular expression cheat sheet for Varnish | |
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX | |
regular expressions, for a complete guide, see: "man 7 regex" | |
Basic matching: | |
req.url ~ "searchterm" | |
True if req.url contains "searchterm" anywhere. | |
req.url == "searchterm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This can be found in the Symfony\Component\HttpFoundation\Response class | |
const HTTP_CONTINUE = 100; | |
const HTTP_SWITCHING_PROTOCOLS = 101; | |
const HTTP_PROCESSING = 102; // RFC2518 | |
const HTTP_OK = 200; | |
const HTTP_CREATED = 201; | |
const HTTP_ACCEPTED = 202; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- if possible: --> | |
<!-- the decode for this image may be deferred --> | |
<img async=on src="space-cats.jpg"> | |
<!-- the decode for this image should not be deferred --> | |
<img async=off src="space-dogs.jpg"> | |
<!-- the browser is free to do what it feels is best for the user --> | |
<img src="space-pizza.jpg"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Features; | |
use App\Features\FirstTask; | |
use App\Features\SecondTask; | |
use Illuminate\Pipeline\Pipeline; | |
// *Naming things is hard* ... So, this is a class called `ProcessClass` that `run()` some text ¯\_(ツ)_/¯ | |
class ProcessClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Helper function. | |
if (! function_exists('timer')) { | |
function timer($expression) | |
{ | |
$start = microtime(true); | |
if ($expression instanceof Closure) { | |
$expression(); |
NewerOlder