Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am alexyoung on github.
  • I am alexyoung ( on keybase.
  • I have a public key whose fingerprint is 620E 32D7 402D A626 1DFB D437 4B84 C8F8 8B53 67E2

To claim this, I am signing this object:

tmux set -g default-shell /bin/bash
tmux set -g default-command /bin/bash
tmux new-session -d -s $SESSION
tmux send-keys "/usr/local/bin/sl" C-m C-d
alexyoung / tmux.conf
Created Jul 19, 2013
tmux cheap powerline
View tmux.conf
#!/usr/bin/env sh
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%\n", $10/$5 * 100)}'
alexyoung / gapi.js
Last active Dec 12, 2015
JSON fixture for the Backbone tutorial
View gapi.js
gapi = {};
gapi.client = {
load: function(path, version, cb) {
oauth2: {
userinfo: {
get: function() {
return {
execute: function(cb) {
View .vimrc
" vim:fdm=marker
" Editor basics {{{
" Behave like Vim instead of Vi
set nocompatible
" Show a status line
set laststatus=2
" Show the current cursor position
alexyoung /
Created Feb 25, 2012
Unix License Plate
#!/usr/bin/env bash
tput civis
tput setab 255
tput clear
./ 7
tput setaf 35
figlet -w `tput cols` -c -f roman "UNIX"
read -s
tput sgr0
View Ext.ux.SchemaGrid.js
Ext.ux.SchemaGrid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function() {
var me = this,
schema = me.initialConfig.schema,
fields = schema.fields,
id =;
var store = new{
root: 'list',
View example.txt
Makefile (run tests)
index.js (require app.js and start it listening on a port)
package.json (include dependencies and devDependencies, package.json isn't just for publishing to npm)
app.js (Set up your Express app, assuming it's Express of course. You could do var User = require('models').User)
index.js (do exports.User = require('./user'); for each model)
alexyoung / Makefile
Created Nov 27, 2011
Publish a subdirectory of documentation to a gh-pages branch
View Makefile
$(eval PARENT_SHA := $(shell git show-ref -s refs/heads/gh-pages))
$(eval DOC_SHA := $(shell git ls-tree -d HEAD docs | awk '{print $$3}'))
$(eval COMMIT := $(shell echo "Auto-update docs." | git commit-tree $(DOC_SHA) -p $(PARENT_SHA)))
@git update-ref refs/heads/gh-pages $(COMMIT)
alexyoung /
Created Nov 27, 2011 — forked from voidfiles/gist:1397205
Breakdown of flickr's pre-script loading event handler

Production Tear Down: How Does Flickr Handle Loading Scripts Asynchronously?

If you are using an async loader, or even if you are just putting your scripts at the bottom of your DOM, you have a problem. In some cases your scripts will load after the user has clicked on something that requires a JavaScript function to handle the click. It's possible you have a pure HTML version, but if the user has JavaScript we want them to use it, even if the JavaScript hasn't loaded yet. You need some way of handling events before all of your assets have finished loading.

There are a number of ways we could do this, but it's helpful to look at a working implementation. This is going to be a two part series. First, we are going to look at how Flickr does this. In the second part, we can take the code that Flickr uses and extract the main features so that anyone can use the code.

In all of the code that Flickr loads before the body this is the part that matters to us: [Isolated actionQueue Code](