Skip to content

Instantly share code, notes, and snippets.

View jasondavies's full-sized avatar
💭
💡

Jason Davies jasondavies

💭
💡
View GitHub Profile
@jasondavies
jasondavies / README.md
Last active August 29, 2015 13:58 — forked from mbostock/README.md
Voronoi Clip Bug

There seems to be a bug in voronoi clipping; setting .clipExtent([[-1, -10], [width + 1, height + 1]]) works around the issue for these particular points.

@jasondavies
jasondavies / csv-benchmark
Last active August 29, 2015 14:02
d3.csv benchmark
#!/usr/bin/env node
var d3 = require("./");
var csv = ["foo", "bar", "baz", "foobarbaz", "BLAHBLAH"].join(",") + "\n" +
d3.csv.formatRows(d3.range(10000).map(function() {
return d3.range(5).map(Math.random);
}));
benchmark("Slow", function() { parseSlow(csv); });
@jasondavies
jasondavies / index.html
Created June 12, 2014 18:35
Cocircular Voronoi
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.voronoi {
fill-opacity: .5;
}
.delaunay {
@jasondavies
jasondavies / .gitignore
Last active August 29, 2015 14:04 — forked from mbostock/.block
Quantised States
.DS_Store
build
node_modules
@jasondavies
jasondavies / README.md
Last active August 29, 2015 14:04 — forked from mbostock/.block
Wrapped d3.geo.tile
/**
* Support for generating SHA-1 of a stream.
*
* Based on http://pajhome.org.uk/crypt/md5/sha1.js.
*/
function naked_sha1_head() {
var w = Array(80);
var a = 1732584193;
var b = -271733879;
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index 2550961..1e45a62 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -82,3 +82,4 @@ _view = {couch_httpd_view, handle_view_req}
_show = {couch_httpd_show, handle_doc_show_req}
_list = {couch_httpd_show, handle_view_list_req}
_info = {couch_httpd_db, handle_design_info_req}
+_rewrite = {couch_httpd_rewrite, handle_rewrite_req}
diff --git a/share/Makefile.am b/share/Makefile.am
(function (exports) {
// because the anonymous function is being called without a scope being set,
// "this" will refer to the global scope. In a browser, that's the window, but
// will be "undefined" in strict mode. In other JS platforms, it may be some
// other thing.
// my code here.
// don't make accidental globals.
// hang a small number of things on the "exports" object.

This example is a simple loupe using Polymaps. Drag the center of the loupe to move it around, or drag the thick border to resize it. Loupes are normally used to magnify, showing focus and context, but in this example we're using it to show two different tilesets. You can enable magnification (or minification) using the zoomDelta property.

javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.4.2",function($,L){var gist_re=/^https?\:\/\/gist\.github\.com\/(\d*)/i,rel_re=/^\/?(\d+)$/,on_gist=gist_re.test(location.href);$("a").each(function(){var b=$(this).attr("href")||'',a=b.match(gist_re);if(on_gist&&!(a&&a[1])){a=b.match(rel_re)}if(a&&a[1]){$(this).after(' <a href="http://bl.ocks.org/'+a[1]+'">[bl.ocks.org]</a>')}});});