Skip to content

Instantly share code, notes, and snippets.

View defenestrator's full-sized avatar

Jeremy Jacob Anderson defenestrator

  • I'm great company.
  • Boise, ID
  • 20:07 (UTC -06:00)
View GitHub Profile
#!/bin/sh
sudo yum install -y gcc
wget http://download.redis.io/releases/redis-2.8.17.tar.gz
tar xzf redis-2.8.17.tar.gz
cd redis-2.8.17
make
sudo cp ./src/redis-server /usr/local/bin/
sudo cp ./src/redis-cli /usr/local/bin/
@defenestrator
defenestrator / gist:5d5d3fd729b58cc87288
Last active August 29, 2015 14:20
hiddenFilesOsxToggle.sh
#!/bin/bash
STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ];
then
defaults write com.apple.finder AppleShowAllFiles NO
else
defaults write com.apple.finder AppleShowAllFiles YES
fi
killall -TERM Finder
@defenestrator
defenestrator / _social-colors-2014.scss
Created September 27, 2015 00:07 — forked from math-is-hard/_social-colors-2014.scss
Social Network Colors (2014)
/* Social
======================================================================================= */
$col-addthis : #fe6d4c;
$col-blogger : #fb8f3d;
$col-dribbble : #ea4c89;
$col-facebook : #3b5998;
$col-flickr : #ff0084;
$col-forrst : #5B9A68;
$col-foursquare : #0072b1;
$col-googleplus : #dd4b39;
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@defenestrator
defenestrator / Country.php
Created August 8, 2015 14:10
PHP Countries Utitility Class
<?php
namespace App\Http\Utilities;
class Country {
protected static $countries = [
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
@defenestrator
defenestrator / state-abbr.js
Created October 28, 2016 17:45
Two-way State/Abbreviation Transformer
function convert_state(name, to) {
var name = name.toUpperCase();
var states = new Array( {'name':'Alabama', 'abbrev':'AL'}, {'name':'Alaska', 'abbrev':'AK'},
{'name':'Arizona', 'abbrev':'AZ'}, {'name':'Arkansas', 'abbrev':'AR'}, {'name':'California', 'abbrev':'CA'},
{'name':'Colorado', 'abbrev':'CO'}, {'name':'Connecticut', 'abbrev':'CT'}, {'name':'Delaware', 'abbrev':'DE'},
{'name':'Florida', 'abbrev':'FL'}, {'name':'Georgia', 'abbrev':'GA'}, {'name':'Hawaii', 'abbrev':'HI'},
{'name':'Idaho', 'abbrev':'ID'}, {'name':'Illinois', 'abbrev':'IL'}, {'name':'Indiana', 'abbrev':'IN'},
{'name':'Iowa', 'abbrev':'IA'}, {'name':'Kansas', 'abbrev':'KS'}, {'name':'Kentucky', 'abbrev':'KY'},
{'name':'Louisiana', 'abbrev':'LA'}, {'name':'Maine', 'abbrev':'ME'}, {'name':'Maryland', 'abbrev':'MD'},
{'name':'Massachusetts',
<?php
/*
//Normal query
User::all();
//Cached query (default 60min)
User::cached()->all();
//Cached query (5min)
@defenestrator
defenestrator / laravel-forge-deploy.sh
Last active April 22, 2021 18:29 — forked from tonioriol/laravel-forge-deploy.sh
Laravel Forge zero downtime deployment script
# stop script on error signal
set -e
SITE="example.com"
DEPL="/home/forge/deployments/${SITE}"
# create directory and any intermediate directories if don't exist
mkdir -p ${DEPL}
CUR="/home/forge/${SITE}"
NEW="${DEPL}/new"
BKP="${DEPL}/backup"
@defenestrator
defenestrator / laravel_envoyer_migrations_like_a_boss.sh
Last active June 9, 2021 08:13
Laravel Envoyer hook to run migrations in a sane manner
# Application base directory
site= "example.com"
# Navigate to the release being deployed.
cd {{ release }}
# Number of migrations in the new release
releaseMigrations= ls database/migrations | wc -l
# Number of migrations in the current production app
@defenestrator
defenestrator / awesome_favorite_fizzbuzz.js
Last active May 17, 2022 04:45
Some Fizzbuzz for meditation
// This one is interesting because no previously checked condition is re-checked
// It is a self-executing function that contains a declarative function named fizzbuzz() and a for loop
// Too much fun
(function() {
function fizzbuzz(i) {
const test = (d, s, x) => i % d == 0 ? _ => s + x('') : x
const fizz = x => test(3, 'Fizz', x)
const buzz = x => test(5, 'Buzz', x)
console.log(fizz(buzz(x=>x))(i.toString()))
}