Skip to content

Instantly share code, notes, and snippets.

@robbieh
robbieh / babel-distance.clj
Last active December 24, 2022 16:23
Manhattan distance like walk, but across a hex grid
;Named "Babel distance" after the Borges story "The Library of Babel"
(def bearings
{:E [120 240 0 360
:NE [60 180 300]
:NW [120 240 0 360
:W [60 180 300]
:SW [120 240 0 360
:SE [60 180 300]})
(def f (new Frame "AWT test"))
(. f setSize 400 400)
(. f setLayout (new GridLayout 3 1))
(class f) ;;java.awt.Frame
(supers (class f));; #{java.awt.Container java.io.Serializable java.awt.Window java.awt.image.ImageObserver java.awt.Component java.awt.MenuContainer java.lang.Object javax.accessibility.Accessible}
(r/reflect (.getAccessibleContext f) )
(def acc (AWTAccessor/getComponentAccessor))
@robbieh
robbieh / sv.bash
Created November 12, 2017 22:18 — forked from WoodenDoors/sv.bash
/etc/bash_completion.d/sv
_runit_sv() {
local cur prev commands opts services
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="status up down once \
pause cont hup alarm interrupt quit 1 2 term kill exit \
start stop reload restart shutdown \
@robbieh
robbieh / gist:4171210
Created November 29, 2012 19:15
How do you read this?
(reduce (fn [accum x]
(assoc accum
(keyword x)
(str x \- (rand-int 100))))
{}
["hi" "hello" "bye"])