Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Bostock mbostock

View GitHub Profile
View base64.js
function encode(s) {
var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
o = [];
for (var i = 0, n = s.length; i < n;) {
var c1 = s.charCodeAt(i++),
c2 = s.charCodeAt(i++),
c3 = s.charCodeAt(i++);
o.push(c.charAt(c1 >> 2));
o.push(c.charAt(((c1 & 3) << 4) | (c2 >> 4)));
o.push(c.charAt(i < n + 2 ? ((c2 & 15) << 2) | (c3 >> 6) : 64));
@mbostock
mbostock / perlin-worker.js
Created Aug 20, 2010
Polymaps / Procedural Perlin
View perlin-worker.js
onmessage = function(e) {
var data = e.data.data = [],
n = Math.pow(2, 7 - e.data.zoom),
x0 = e.data.column * n,
y0 = e.data.row * n,
w = e.data.size.x,
h = e.data.size.y;
for (var y = 0, i = 0; y < h; y++) {
for (var x = 0; x < w; x++) {
@mbostock
mbostock / app.yaml
Created Aug 26, 2010
polymaps.appspot.com
View app.yaml
application: polymaps
version: 1
runtime: python
api_version: 1
handlers:
- url: /state/.*
script: main.py
- url: /county/.*
@mbostock
mbostock / jsonp.diff
Created Aug 31, 2010
Polymaps / JSONP Queue
View jsonp.diff
diff --git a/src/Queue.js b/src/Queue.js
index d243c13..616dbc6 100644
--- a/src/Queue.js
+++ b/src/Queue.js
@@ -99,5 +99,41 @@ po.queue = (function() {
return {abort: abort};
}
- return {text: text, xml: xml, json: json, image: image};
+ function jsonp(src, callback) {
@mbostock
mbostock / .block
Last active Jun 16, 2016
Hello, bl.ocks.org!
View .block
license: gpl-3.0
@mbostock
mbostock / .block
Last active Dec 6, 2016
Streamgraph
View .block
license: gpl-3.0
@mbostock
mbostock / .block
Last active Feb 8, 2016
Pale Dawn
View .block
license: gpl-3.0
@mbostock
mbostock / .block
Last active Feb 8, 2016
Cellular automata
View .block
license: gpl-3.0
redirect: https://beta.observablehq.com/@mbostock/1d-cellular-automaton
@mbostock
mbostock / .block
Last active Feb 8, 2016
CSS3 Modal Button
View .block
license: gpl-3.0
@mbostock
mbostock / .block
Last active Feb 8, 2016
Minecraft Overviewer
View .block
license: gpl-3.0