Skip to content

Instantly share code, notes, and snippets.

View thurloat's full-sized avatar

Adam Thurlow thurloat

View GitHub Profile
@thurloat
thurloat / BackboneViewFactory.js
Created February 7, 2012 16:25 — forked from anonymous/Backbone ViewFactory
Backbone ViewFactory
var ViewFactory = (function() {
function ViewFactory(pubSub) {
this.pubSub = pubSub;
this.registry = {};
this.registry['factory'] = this;
}
ViewFactory.prototype.register = function(key, value) {
return this.registry[key] = value;
@thurloat
thurloat / qa.coffee
Created February 6, 2012 13:23 — forked from honza/qa.coffee
Quicksort in Haskell & Python
qs = (arr) ->
[].concat qs(i for i in arr when i < arr[0]), [arr[0]], qs(i for i in arr when i > arr[0]) if arr.length <= 1 else arr
data = ServerResponses.initialData
# data.player.points = 10
# oh noes, we have ServerResponses.initialData infected
data = _.clone data
data.player = _.clone data.player
data.player.points = 10
server_mock.respondTo "GET /something", data
data = ServerResponses.initialData
data = merge data,
player:
points: 10
awarded_prize:
prize:
name: "Better prize"
@thurloat
thurloat / install_nginx.sh
Created November 23, 2011 12:11
install nginx
#!/bin/sh
set -x
nginx_version=1.0.10
sudo apt-get install gcc
sudo apt-get install libpcre3-dev
sudo apt-get install libssl-dev
mkdir install_nginx && cd install_nginx
@thurloat
thurloat / output
Created September 28, 2011 13:26 — forked from minichate/output
Metaclasses
class M(object):
def __init__(self, *args, **kwargs):
super(M, self).__init__()
setattr(self, "foo", self.baz)
setattr(self, "other_long_name", self.baz)
setattr(self, "metatastic", True)
@classmethod
def baz(cls):
return "FooBaz -- Base class %s" % cls
@thurloat
thurloat / coffee.json
Created June 17, 2011 14:08 — forked from minichate/coffee.json
Timmys Run
{
"Christopher Troup": [
{
item: "Coffee",
modifiers: [
cream: 2,
sugar: 2
],
amount: 1
},
h1. Git for deployment
Pros:
* instant (atomic?) switching
* diffs between versions are concise and can include commits
* VERY little space
* pre and post-update hooks allow you to reject pushes that may overwrite un-commited data
Cons:
@thurloat
thurloat / gist:193976
Created September 26, 2009 01:49 — forked from kastner/gist:193968
(__(__)==D ~ ~(___☼___)