Skip to content

Instantly share code, notes, and snippets.

View nefarioustim's full-sized avatar

Tim Huegdon nefarioustim

View GitHub Profile
import urllib
try:
from urlparse import parse_qs
except ImportError:
from cgi import parse_qs
def url_params(url, **kwargs):
bits = url.split('?')
query_vars = {}
if len(bits) > 1:
@nefarioustim
nefarioustim / world.js
Created April 18, 2012 08:59 — forked from andyhd/world.js
render with one loop
function drawMap(map) {
var x, y,
width = map[0].length,
current_node = map.length * width;
while (current_node--) {
x = current_node % width;
y = ~~(current_node / width);
drawTile({
x: x,
y: y
@nefarioustim
nefarioustim / perlin-noise-classical.js
Created November 10, 2012 18:25 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough [email protected]
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
(function (LocalStorage) {
var DELIM = "|";
LocalStorage.readit = function (key) {
console.log('FN .get for key', key);
var str = localStorage.getItem(key);
console.log('get raw=', str); // e.g. 't35'
if (str === null || str === ''){
return null
}