Skip to content

Instantly share code, notes, and snippets.

View RDelorier's full-sized avatar

Ricky Delorier RDelorier

  • United States
  • 13:11 (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 / 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 / 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 / .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 | \
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 959 593" width="959" height="593">
<title>Blank US states map</title>
<g id="outlines">
<path id="AK" fill="#D3D3D3" d="M161.1,453.7 l-0.3,85.4 1.6,1 3.1,0.2 1.5,-1.1 h2.6 l0.2,2.9 7,6.8 0.5,2.6 3.4,-1.9 0.6,-0.2 0.3,-3.1 1.5,-1.6 1.1,-0.2 1.9,-1.5 3.1,2.1 0.6,2.9 1.9,1.1 1.1,2.4 3.9,1.8 3.4,6 2.7,3.9 2.3,2.7 1.5,3.7 5,1.8 5.2,2.1 1,4.4 0.5,3.1 -1,3.4 -1.8,2.3 -1.6,-0.8 -1.5,-3.1 -2.7,-1.5 -1.8,-1.1 -0.8,0.8 1.5,2.7 0.2,3.7 -1.1,0.5 -1.9,-1.9 -2.1,-1.3 0.5,1.6 1.3,1.8 -0.8,0.8 c0,0 -0.8,-0.3 -1.3,-1 -0.5,-0.6 -2.1,-3.4 -2.1,-3.4 l-1,-2.3 c0,0 -0.3,1.3 -1,1 -0.6,-0.3 -1.3,-1.5 -1.3,-1.5 l1.8,-1.9 -1.5,-1.5 v-5 h-0.8 l-0.8,3.4 -1.1,0.5 -1,-3.7 -0.6,-3.7 -0.8,-0.5 0.3,5.7 v1.1 l-1.5,-1.3 -3.6,-6 -2.1,-0.5 -0.6,-3.7 -1.6,-2.9 -1.6,-1.1 v-2.3 l2.1,-1.3 -0.5,-0.3 -2.6,0.6 -3.4,-2.4 -2.6,-2.9 -4.8,-2.6 -4,-2.6 1.3,-3.2 v-1.6 l-1.8,1.6 -2.9,1.1 -3.7,-1.1 -5.7,-2.4 h-5.5 l-0.6,0.5 -6.5,-3.9 -2.1,-0.3 -2.7,-5.8 -3.6,0.3 -3.6,1.5 0.5,4.5 1.1,-2.9 1,0.3 -