Skip to content

Instantly share code, notes, and snippets.

View richtaur's full-sized avatar
👁️
valadria.com

Matt Hackett richtaur

👁️
valadria.com
View GitHub Profile
@richtaur
richtaur / css.js
Created August 27, 2009 23:07
html.js
// just toying around with some ideas
ul = {
backgroundImage : url('hurr'),
font : {
weight : 'bold',
},
li : {
@richtaur
richtaur / gist:190611
Created September 21, 2009 22:30
Quick JSDOC-like notation for describing objects in a Scribblenauts-type world (only better, that game is not great)
// Quick JSDOC-like notation for describing objects in a Scribblenauts-type world (only better, that game is not great)
@param {String} name (eg. 'Zombie')
@param {Boolean} alive
@param {String} type (
'animal', 'humanoid', 'insect', 'bludgeon weapon', 'projectile weapon', '...?'
)
@param {Object} alive {
@param {Number} aggression
@richtaur
richtaur / npm.txt
Created October 13, 2009 06:02
what
# Node Package Manager
npm [npm-options] command [command options]
install <package>
[-b (stable, edge, nightly) | --branch]
[-f | --force]
[-v | --version]
remove <package>
[-f | --force]
// Transcribe of the code from http://www.slideshare.net/Dmitry.Baranovskiy/canvas-2195590
var ctx = el.getContext('2d');
ctx.save();
ctx.restore();
ctx.scale(w, h);
ctx.rotate(angle);
ctx.translate(x, y);
ctx.transform(m11, m12, m21, m22, dx, dy);
ctx.setTransform(m11, m12, m21, m22, dx, dy);
@richtaur
richtaur / left4defense.js
Created October 19, 2009 02:39
zombie game in Diggy?
(function() {
var SCREEN_WIDTH = 480,
SCREEN_HEIGHT = 360,
SPRITE_SIZE = 24,
TILE_SIZE = 24,
TILES_WIDTH = 20,
TILES_HEIGHT = 15;
var game,
@richtaur
richtaur / DGE.audio.js
Created October 20, 2009 06:55
Diggy Audio example
/**
* DGE audio Object. This is how I want the API to look
*/
/*
DGE.audio = {
mute : function() {
},
volume : function() {
},
@richtaur
richtaur / gist:232720
Created November 12, 2009 08:15
bound
Function.prototype._ = function() {
var that = this, args = arguments;
return function() {
that.apply(that, args);
};
};
@richtaur
richtaur / API sketch 1
Created December 11, 2009 20:07
which API do you prefer?
// A Text object in this example can just be something simple like <div>text here</div>
var text = new Text();
// --- API type A ---
// Sets the color to "red"
text.color('red');
// No parameter passed means it returns the color (in this case, "red")
var color = text.color();
@richtaur
richtaur / API sketch 2
Created February 2, 2010 07:44
Diggy API
var obj = new SpecialObject();
// Type A - single value passed in.
obj.on('set:image', function(image) {
// This part is unimportant, just an example
setCSS('background-image', image);
// Stops the event
return false;
@richtaur
richtaur / main.py
Created March 30, 2010 18:23
critique my python!
#!/usr/bin/env python
import cgi
import simplejson as json
import os
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util