Skip to content

Instantly share code, notes, and snippets.

@fogonwater
fogonwater / simple_rrt.py
Last active July 25, 2017 15:31
Simple rapidly-exploring tree for exploring a space. Only tested in Python 2.x, but is likely to work in Python 3.x.
from __future__ import division
import math
from random import randint, choice
def distance(p1, p2):
""" Euclidean distance """
return math.hypot(p2[0] - p1[0], p2[1] - p1[1])
def step_towards(p1, p2, step_dist=5):
""" Find point a specified distance between p1 & p2 """
@fogonwater
fogonwater / .block
Last active November 29, 2017 18:58
slowly drifting off
license: mit
@fogonwater
fogonwater / README.md
Last active November 30, 2017 19:43
glitch map

Glitchy D3.js map of the world. This combination of clipAngle with geo.mercator() sends things particularly crazy.

@fogonwater
fogonwater / README.md
Last active November 30, 2017 19:50
Rugby score area chart

Quick demonstration of a way to visualise sports scores with area charts.

@fogonwater
fogonwater / .block
Last active November 30, 2017 21:11
On the impossibility of focusing.
license: mit
@fogonwater
fogonwater / .block
Last active December 1, 2017 21:56
Visualising electorate and party vote flows
license: mit
@fogonwater
fogonwater / .block
Last active December 1, 2017 23:51
labels from csv with d3.annotation()
license: mit
@fogonwater
fogonwater / .block
Last active December 2, 2017 02:57
forceRadial tests II
license: mit
@fogonwater
fogonwater / .block
Last active December 5, 2017 00:23
Earnings calendar
license: mit
@fogonwater
fogonwater / helpers.js
Last active December 5, 2017 00:25
Draft visualisation of NZ Government structure
//jetpack
!function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("d3")):"function"==typeof define&&define.amd?define(["d3"],b):a.d3=b(a.d3)}(this,function(a){function c(a){if("string"==typeof a){var e,c={},d=a.split(b);for(a=d.shift();e=d.shift();)"."==e?c.class=c.class?c.class+" "+d.shift():d.shift():"#"==e&&(c.id=d.shift());return c.id||c.class?{tag:a,attr:c}:a}return a}function d(b){var c=a.namespace||a.ns.qualify;return"function"==typeof b?b:(b=c(b)).local?function(){return this.ownerDocument.createElementNS(b.space,b.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,b)}}function e(a){return"function"==typeof a?a:function(){return this.querySelector(a)}}a.selection.prototype.translate=function(a){return this.attr("transform",function(b,c){return"translate("+["function"==typeof a?a.call(this,b,c):a]+")"})},a.transition.prototype.translate=function(a){return this.attr("transform",function(b,c){return"translate("+["function"==typeof a?a.call(this,b,c):