Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am alexyoung on github.
  • I am alexyoung (https://keybase.io/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:

View train.sh
#!/bin/bash
SESSION=tlol
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
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
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) {
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
alexyoung / unix.sh
Created Feb 25, 2012
Unix License Plate
View unix.sh
#!/usr/bin/env bash
tput civis
tput setab 255
tput clear
./vpad.sh 7
tput setaf 35
figlet -w `tput cols` -c -f roman "UNIX"
./center.sh "LIVE FREE OR DIE"
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 = Ext.id();
var store = new Ext.data.JsonStore({
root: 'list',
View example.txt
my-project/
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)
lib/
app.js (Set up your Express app, assuming it's Express of course. You could do var User = require('models').User)
controllers/
users.js
models/
index.js (do exports.User = require('./user'); for each model)
@alexyoung
alexyoung / Makefile
Created Nov 27, 2011
Publish a subdirectory of documentation to a gh-pages branch
View Makefile
publishdocs:
$(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
alexyoung / 2011-11-28-flickr-breakdown.md
Created Nov 27, 2011 — forked from voidfiles/gist:1397205
Breakdown of flickr's pre-script loading event handler
View 2011-11-28-flickr-breakdown.md

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](https://gist.github.com/139