Skip to content

Instantly share code, notes, and snippets.


Richard Delorier RDelorier

View GitHub Profile
View states_hash.json
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
RDelorier / example.html
Last active Jan 27, 2017
Vue js filter to use with select options
View example.html
users = [
{ name:'foo', id:1 },
{ name:'bar', id:2 },
{ name:'baz', id:3 }
RDelorier / chosen_select.js
Created Nov 18, 2015
Notify Vue when chosen select updates
View chosen_select.js
"use strict";
import Vue from 'vue';
Vue.directive('chosen', {
var event = document.createEvent('HTMLEvents');
event.initEvent('change', true, true);
RDelorier / encrypt.php
Last active Jan 20, 2016
Laravel compatible encrypt method
View encrypt.php
* Encrypts the value in a way compatible with laravel 5.1
* @param $value value to encrypt
* @return string
function encrypt($value)
View HasOneScoped.php
namespace App\Models\Relations;
use Illuminate\Database\Eloquent\Relations\HasOne;
class HasOneScoped extends HasOne
protected $attributes = [];
View Quill.vue
<div class="quill-editor">
<!-- Create toolbar container -->
<div id="toolbar" ref="toolbar" @click.prevent>
<select class="ql-size">
<option value="small"></option>
<option selected></option>
<option value="large"></option>
<option value="huge"></option>
View TransformsViaFractal.php
namespace App\Traits;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
trait TransformsViaFractal
* Convert current item into a fractal instance.
RDelorier / AccessToken.php
Created Jan 27, 2017
Passport jwt additional claims
View AccessToken.php
namespace App\Auth;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\Entities\ClientEntityInterface;
View .gitconfig
email =
name = Ricky Delorier
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg2 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
excludesfile = /Users/rdelorier/.gitignore_global
## Slow requests grouped by function call
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr
## Slow requests grouped by minute
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c
## Top 25 1 minute groups of slow requests
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \