Skip to content

Instantly share code, notes, and snippets.

View acjbizar's full-sized avatar
💙
Nosce te ipsum dolor sit amet.

ACJ acjbizar

💙
Nosce te ipsum dolor sit amet.
View GitHub Profile
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
@robinhouston
robinhouston / wilson.c
Last active September 7, 2023 03:28
Another method for generating “all RGB” images
// 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
@robinhouston
robinhouston / universal-tartan.py
Created March 4, 2014 21:01
A 4096×4096 image containing each RGB value once (h/t allrgb.com). Z-order traversal of RGB cube mapped to z-order traversal of 4096×4096 square.
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()