Skip to content

Instantly share code, notes, and snippets.

View alexyoung's full-sized avatar
💤

Alex Young alexyoung

💤
View GitHub Profile

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:

@alexyoung
alexyoung / train.sh
Created November 27, 2013 14:06
Tmux Train
#!/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 July 19, 2013 16:12
tmux cheap powerline
#!/usr/bin/env sh
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%\n", $10/$5 * 100)}'
@alexyoung
alexyoung / gapi.js
Last active December 12, 2015 06:38
JSON fixture for the Backbone tutorial
gapi = {};
gapi.client = {
load: function(path, version, cb) {
cb();
},
oauth2: {
userinfo: {
get: function() {
return {
execute: function(cb) {
@alexyoung
alexyoung / .vimrc
Created May 16, 2012 11:12
mouse-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 February 25, 2012 18:24
Unix License Plate
#!/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
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',
@alexyoung
alexyoung / example.txt
Created December 9, 2011 16:58
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 November 27, 2011 23:41
Publish a subdirectory of documentation to a gh-pages branch
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 November 27, 2011 14:58 — 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](https://gist.github.com/139