Skip to content

Instantly share code, notes, and snippets.

View captainhead's full-sized avatar

Chris captainhead

View GitHub Profile
@captainhead
captainhead / hexagon.js
Last active May 21, 2019 01:14
A Hexagon symbol for D3
const a = Math.pow(3, 0.25);
// Given an area, compute the side length of a hexagon with that area.
function sideLength(area) {
return a * Math.sqrt(2 * (area / 9));
}
// Generate the 6 vertices of a unit hexagon.
const basePoints = d3
.range(6)
@captainhead
captainhead / write_edn.clj
Created November 27, 2018 20:18
Barebones write a hashmap to an EDN file.
(defn write-edn
[]
(with-open [w (clojure.java.io/writer "outputdirectory/filename.edn")]
(binding [*out* w]
(clojure.pprint/write {:my-hashmap "data"}))))