Skip to content

Instantly share code, notes, and snippets.

View statianzo's full-sized avatar
🎯
Focusing

Jason Staten statianzo

🎯
Focusing
View GitHub Profile
  • Event Constants
    • BEM style - BUZZ__MESSAGE_CREATED instead of CREATED_BUZZ_MESSAGE
    • Past tense - BUZZ__MESSAGE_LIKED instead of BUZZ__LIKE_MESSAGE
    • When multi-step, use _STARTED, _FINISHED, and _FAILED suffix
      • BUZZ__LOAD_CHANNEL_MESSAGES_STARTED
      • BUZZ__LOAD_CHANNEL_MESSAGES_FAILED
  • BUZZ__LOAD_CHANNEL_MESSAGES_FINISHED
@statianzo
statianzo / di.js
Created June 22, 2015 17:00
Simple DI
var deps = {};
function register(name, value) {
deps[name] = value;
}
function inject(fn) {
var wants = fn.wants || [];
var resolved = wants.map(resolve);
return fn.apply(null, resolved);
@statianzo
statianzo / openssl.sh
Last active August 29, 2015 14:17 — forked from colby/openssl.sh
#!/bin/bash
awk=$(which awk || echo 'missing: install awk' && exit 1)
# update apt
sudo apt-get update
# get ssl related packages from simulated upgrade
sudo apt-get upgrade -s | grep ssl | grep Inst | $awk '{print $2}' | xargs -t sudo apt-get install
@statianzo
statianzo / cxenv.sh
Last active August 29, 2015 14:07
Run a command in the same environment as a cloud66 stack
#!/bin/bash
set -eo pipefail
usage(){
echo "Usage: cxenv stack environment [command]"
exit 1
}
[ $# -lt 3 ] && usage
@statianzo
statianzo / docker-check.sh
Created September 15, 2014 20:43
Run command on docker image change
#!/bin/bash
set -eo pipefail
usage(){
echo "Usage: docker-check image [command]"
exit 1
}
version(){
@statianzo
statianzo / etcdenv.sh
Last active August 29, 2015 14:06
etcd directory to env file, supports recursion
#!/bin/bash
set -eo pipefail
usage(){
echo "etcdenv - Recursively prints etcd dir as environment file"
echo "Usage: etcdenv rootdir"
exit 1
}
"template": {
"data": [
{"name": "full-name", "value": "Joe", "prompt": "Full Name"},
{"name": "sports", "parameter": "quiz[sports]", "prompt": "Sports",
"template": {
"data": [
{"parameter": "best_rugby", "name": "rugby", "prompt": "Best rugby team?", "value": "All Blacks" }
]
}
}
@statianzo
statianzo / PKGBUILD.diff
Last active August 29, 2015 14:01
openresty PKGBUILD update
--- PKGBUILD.old 2013-09-30 14:24:47.000000000 -0600
+++ PKGBUILD 2014-05-27 12:59:49.359684637 -0600
@@ -4,7 +4,7 @@
_tmpdir=/var/lib/openresty
pkgname=openresty
_pkgname=ngx_openresty
-pkgver=1.4.2.9
+pkgver=1.5.12.1
pkgrel=1
pkgdesc="a powerful web app server by extending nginx"
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
module CsrfHelpers
def token
session[:csrf] ||= SecureRandom.hex(32)
end
def csrf_input_tag
%Q(<input type="hidden" name="authenticity_token" value="#{token}" />)
end
def csrf_meta_tag