Skip to content

Instantly share code, notes, and snippets.

@kylehg
kylehg / eslint.json
Last active November 15, 2016 05:23
JavaScript Style Guide
{
"env": {
"es6": true
},
"rules": {
"accessor-pairs": 2,
"arrow-spacing": [2, {"before": true, "after": true}],
"block-spacing": [2, "always"],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"comma-dangle": [2, "always-multiline"],
@kylehg
kylehg / idgen.go
Last active October 1, 2015 07:32
Generic ID generation
// A package for generating and consuming intelligent IDs.
//
// This package exposes a factory function for ID generators, that creates IDs
// that are 64-bit unsigned ints, with bits breaking down as possible:
//
// [TYPE: 8 bits] [ID: 52 bits]
//
// - TYPE (256 options): The type of the object the ID represents.
// - ID (4.5 quadrillion options): The actual ID, depending on the indicated
// sequence type. It should ideally be monotonically increasing so that IDs
@kylehg
kylehg / strictify.sh
Created March 10, 2016 19:01
Add 'use strict' to all JS files that don't have it
FILES=$(git grep -L "use strict" lib/shared/**/*.js)
for f in $FILES; do
echo "'use strict'" | cat - $f > .tmpfile && mv .tmpfile $f
done
@kylehg
kylehg / Makefile
Last active August 8, 2017 16:02
Heroku Makefile
.PHONY: runprod
runprod:
heroku local web
.PHONY: deploy
deploy:
git checkout master
git pull
git push heroku master
git tag "$$(heroku releases -n 1 | awk '{print $$1}' | sed -n 2p)"