This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Handlebars.registerHelper('slugify', function(title) { | |
| return title.toLowerCase() | |
| .replace(/ /g,'-') | |
| .replace(/[^\w-]+/g,''); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // gcc -g -Wall --std=c99 wilson.c -lpng -o wilson && ./wilson | |
| /* Generate a random spanning tree of the RGB cube, and a random | |
| spanning tree of the pixel grid, using Wilson's algorithm, then | |
| do a simultaneous breadth-first search of these trees to obtain | |
| a bijection between the RGB cube and the pixel grid. | |
| Inspired by allrgb.com. | |
| -- Robin Houston, 2014-03 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| def splitnum(k, x): | |
| parts = [0] * k | |
| for n in range(24): | |
| parts[n % k] |= ((x >> n) & 1) << (n // k) | |
| return tuple(parts) | |
| im = Image.new("RGB", (4096, 4096)) | |
| pix = im.load() |