Skip to content

Instantly share code, notes, and snippets.

View jasondavies's full-sized avatar
💭
💡

Jason Davies jasondavies

💭
💡
View GitHub Profile
/**
* 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>')}});});
var h = po.hash(), defaultFormat = h.format(), folio = '';
map
.add(po.interact())
.add(po.compass().pan("none"))
.add(h.parse(function(s) {
var args = s.split('/');
folio = args[0];
if (folioLayers[folio]) {
currentLayer.visible(false);
currentLayer = folioLayers[folio].visible(true);
<svg xmlns="http://www.w3.org/2000/svg">
<g transform="translate(10,10)">
<path d="M0,0 C0,100 100,0 100,100" stroke="#000" stroke-width="1" fill="none"/>
</g>
</svg>
@jasondavies
jasondavies / cluster.css
Created June 22, 2011 08:27
Pedigree Chart
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}
.node {
font: 10px sans-serif;
}
@jasondavies
jasondavies / README.mkd
Created July 7, 2011 23:37 — forked from mbostock/.block
Resizable Markers

A quick example demonstrating the use of "show" event handlers and reshow, which allows you to restyle GeoJSON features dynamically from an external event. In this example, you can use the jQuery UI slider in the top-left corner to resize the points.

@jasondavies
jasondavies / ciliarisDAR.js
Created July 9, 2011 12:35 — forked from blahah/ciliarisDAR.js
LatticeXY chart
//Eragrostis ciliaris dry-after ripening germination data
var ddays = ["0630°/days","1260°/days","1890°/days","2520°/days"];
var RH = [20, 35, 50, 65];
var data = [{"temp":"30°C","RH":20,"ddays":"0630°/days","days":0,"germ":0},
{"temp":"30°C","RH":20,"ddays":"0630°/days","days":1,"germ":0},
{"temp":"30°C","RH":20,"ddays":"0630°/days","days":4,"germ":0},
{"temp":"30°C","RH":20,"ddays":"0630°/days","days":8,"germ":0},
{"temp":"30°C","RH":20,"ddays":"0630°/days","days":14,"germ":0},
{"temp":"30°C","RH":20,"ddays":"0630°/days","days":28,"germ":0},