Skip to content

Instantly share code, notes, and snippets.

@robinhouston
robinhouston / prisoners_japh.pl
Created January 21, 2016 14:02
A Perl program using only the characters &+-.:<=>acemnorsuvwxz~ – see http://bumppo.net/lists/fun-with-perl/2001/01/msg00019.html
s==x= && s==.er & xac.uc coer= && s==m--+m--+m--+m--=e &&
s==xac.~o= && s=.+=<<x& evam=ee &&
eva~
x
s=c.=c= && s=x=xz&<<o=e &&
xm
o
s=x=x = && s=x=<<xc& <<xo =e&&
x~
xc
@robinhouston
robinhouston / .block
Last active February 20, 2016 11:19
Hilbert curves
height: 512
@robinhouston
robinhouston / .block
Last active October 27, 2019 19:12
A worm on a Hilbert curve
width: 512
height: 512
@robinhouston
robinhouston / .block
Last active February 23, 2016 18:11
A different Hilbert curve animation
height: 512
license: gpl-3.0
@robinhouston
robinhouston / .block
Last active April 15, 2016 10:51
An axis with a date scale
height: 40
border: no
@robinhouston
robinhouston / .block
Last active May 20, 2016 12:17 — forked from mbostock/.block
D3 Custom Bundle
license: gpl-3.0
@robinhouston
robinhouston / README.md
Created June 10, 2016 11:07
Force layout issue with D3 v4.0.0 alpha.45

If you press the “Transition & stop” button while the layout is running, then the restart button will not subsequently work. It seems that creating a transition before stopping the layout somehow prevents the layout from being restarted. (Possibly something to do with the fact they both use d3-timer internally?)

@robinhouston
robinhouston / README.md
Created June 10, 2016 12:03
(timer) Force layout issue with D3 v4.0.0 alpha.45

If you press the “Timer & stop” button while the layout is running, then the restart button will not subsequently work. It seems that creating a timer before stopping the layout prevents the layout from being restarted.

@robinhouston
robinhouston / spreadsheet_columns.py
Last active November 23, 2016 12:33
Convert spreadsheet column letters (A,B, …, Z, AA, AB, …) to index numbers, and vice versa
def col_index(col):
"""Take a spreadsheet-style column specifier, e.g. A, M, ZZ,
and convert it to a one-based column index: A=1, Z=26, AA=27, etc.
"""
if not col or set(col) - set("ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
raise Exception("Bad column specifier: '" + col + "'")
return reduce(lambda x,c: 26 * x + ord(c) - 64, col, 0)
def col_letters(index):
"""Take a one-based column index and convert it to a
@robinhouston
robinhouston / README.md
Last active March 31, 2017 00:16
D3 circle transitions: longhand

Implementing the transition the long way round, using transition.tween directly.

Click the circle to restart