Instantly share code, notes, and snippets.

View quotes.md

"A lot of times, you open up some code for something simple like this, and you find that it is just a massive tangle of unnecessary structure and indirection."

Casey Muratori 2014-05-28 (Retrieved 2018-05-18)

View AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Str;
class AppServiceProvider extends ServiceProvider
{
public function boot()
View VersionMatcher.php
<?php
class VersionMatcher
{
protected $specificity = 'major';
protected $originals = [];
protected $current;
protected $target;
protected static $padDigits;
View BaseModel.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
/**
* Override the default boot method to register some extra stuff for every child model.
View list.php
<?php
$items = [
['field' => 'field1', 'values' => [0, 1, 2, 3, 4]],
['field' => 'field2', 'values' => ['cat', 'dog', 'horse']]
];
foreach ($items as list('field' => $field, 'values' => $values)) {
// can use $field and $values here now!
}
View RemoteArtisan.php
<?php
namespace App;
use Dotenv\Dotenv;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class RemoteArtisan
View AuthorizationTest.php
<?php
namespace App\Tests;
use Illuminate\Support\Facades\Route;
class AuthorizationTest extends TestCase
{
public function setUp()
{
View str_common.php
<?php
/**
* Return the common parts from 2 strings.
*
* @param string $str1
* @param string $str2
* @param bool $from_end
* return string
*/
View keybase.md

Keybase proof

I hereby claim:

  • I am simonhamp on github.
  • I am simonhamp (https://keybase.io/simonhamp) on keybase.
  • I have a public key ASAHPdAFANeP0F6wuxEQSZ1pduJknbEHdlTnEIcd6CuB8go

To claim this, I am signing this object:

View AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()