Skip to content

Instantly share code, notes, and snippets.

View aparrish's full-sized avatar

Allison Parrish aparrish

View GitHub Profile
@dariusk
dariusk / canvas2Xscale.js
Created August 29, 2011 14:38
Artifact-free screen scaling for a canvas game, limited to 1X, 2X, 4X
// 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() {
@sleepygarden
sleepygarden / unicode_clippy.py
Created September 27, 2013 21:09
trying to make sense of unicode_ebooks
# -*- coding: utf-8 -*-
import sys
import enchant
"""
trying to make sense of unicode_ebooks
you need pyenchant:
brew install enchant
pip install pyenchant
"""
@brendanberg
brendanberg / lisp.coffee
Created August 24, 2011 07:11
Lisp list functions in CoffeeScript
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