Skip to content

Instantly share code, notes, and snippets.

Allison Parrish aparrish

View GitHub Profile
@dariusk
dariusk / canvas2Xscale.js
Created Aug 29, 2011
Artifact-free screen scaling for a canvas game, limited to 1X, 2X, 4X
View canvas2Xscale.js
// Adapted from Zachary Johnson's Commander Clone 0.2 screen scaling example http://www.zachstronaut.com/projects/commander-clone/0.2/game.html
// Modified to strictly choose 1X or 2X or 4X scaling as appopriate, so we don't end up with screwed up scaling artifacts.
// NOTE: uses jQuery for the DOM load event
$(function () {
fullScreenify();
window.addEventListener('resize', fullScreenify, false);
function fullScreenify() {
@brendanberg
brendanberg / lisp.coffee
Created Aug 24, 2011
Lisp list functions in CoffeeScript
View lisp.coffee
cons = (h, t) -> (m) -> m(h, t)
car = (x) -> x((h, t) -> h)
cdr = (x) -> if x then x((h, t) -> t) else null
map = (ls, f) ->
cons (f car ls), if cdr ls then map cdr(ls), f else null
foldl = (ls, f, n) ->
f (car ls), if cdr ls then foldl (cdr ls), f, n else n
@cyberdelia
cyberdelia / fabfile.py
Created Apr 3, 2010
Fabric deploy script with : south migrations, rollback and maintenance page.
View fabfile.py
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
You can’t perform that action at this time.