Skip to content

Instantly share code, notes, and snippets.

"""Create a map and render it as a pgm image.
(see http://netpbm.sourceforge.net/doc/pgm.html)
"""
import sys
import math
import json
from functools import lru_cache
from noise import snoise2
@caseman
caseman / pagetmpl.js
Created September 10, 2012 17:36
Dolphy slotted page
var docTmplSrc = {
tag: 'html',
attr: {
lang: {slot: 'lang', default: 'en'}
},
content: [
{tag: 'head', content: [
{tag: 'meta', attr: {
'http-equiv': 'Content-Type',
@caseman
caseman / todo.js
Created September 10, 2012 17:01
Dolpy scifi
define(
['Layout', 'Collection', 'Model'],
function('Layout', 'Collection', 'Model') {
'use strict';
Layout.defineWidget('todo-item',
{ tag: 'div',
cls: ['todo-item',
{ test: 'item.completed', yes: 'completed' },
{ test: 'editedItemId == item.id', yes: 'editing' } ],
@caseman
caseman / object-watch.js
Created September 4, 2012 20:06 — forked from eligrey/object-watch.js
object.watch polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@caseman
caseman / gist:3428752
Created August 22, 2012 19:49
Ctor: Lightweight Javascript Constructors with Inheritance

Ctor: Lightweight Javascript Constructors with Inheritance

Author: Casey Duncan @iamnotcasey

This Javascript constructor with inheritance pattern is designed as a lightweight alternative to other methods I've seen while still providing a nice abstraction as a 13 line function that can be easily inlined into your code.