Skip to content

Instantly share code, notes, and snippets.

View RDelorier's full-sized avatar

Ricky Delorier RDelorier

  • United States
  • 13:15 (UTC -12:00)
View GitHub Profile
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@RDelorier
RDelorier / example.html
Last active January 27, 2017 03:54
Vue js filter to use with select options
//js
users = [
{ name:'foo', id:1 },
{ name:'bar', id:2 },
{ name:'baz', id:3 }
];
//html
<select
v-model="user.id"
@RDelorier
RDelorier / chosen_select.js
Created November 18, 2015 04:26
Notify Vue when chosen select updates
"use strict";
import Vue from 'vue';
Vue.directive('chosen', {
bind(){
var event = document.createEvent('HTMLEvents');
event.initEvent('change', true, true);
$(this.el).chosen({
@RDelorier
RDelorier / encrypt.php
Last active January 20, 2016 17:00
Laravel compatible encrypt method
<?php
/**
* Encrypts the value in a way compatible with laravel 5.1
* @param $value value to encrypt
*
* @return string
*/
function encrypt($value)
{
<?php
namespace App\Models\Relations;
use Illuminate\Database\Eloquent\Relations\HasOne;
class HasOneScoped extends HasOne
{
protected $attributes = [];
<template>
<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>
</select>
<?php
namespace App\Traits;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
trait TransformsViaFractal
{
/**
* Convert current item into a fractal instance.
@RDelorier
RDelorier / AccessToken.php
Created January 27, 2017 21:12
Passport jwt additional claims
<?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;
@RDelorier
RDelorier / .gitconfig
Created July 6, 2017 18:33
My Dotfiles
[user]
email = rdelorier@gmail.com
name = Ricky Delorier
[alias]
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
[core]
excludesfile = /Users/rdelorier/.gitignore_global
@RDelorier
RDelorier / parse-slow-log.sh
Created August 8, 2017 15:02 — forked from JCotton1123/parse-slow-log.sh
Parse php-fpm slow log
## 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 | \