Skip to content

Instantly share code, notes, and snippets.

@ewheeler
ewheeler / d3.min.js
Last active August 29, 2015 13:55
ict4d software
d3=function(){function t(t){return t.target}function n(t){return t.source}function e(t,n){try{for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}catch(r){t.prototype=n}}function r(t){for(var n=-1,e=t.length,r=[];e>++n;)r.push(t[n]);return r}function u(t){return Array.prototype.slice.call(t)}function i(){}function a(t){return t}function o(){return!0}function c(t){return"function"==typeof t?t:function(){return t}}function l(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function f(t){return null!=t&&!isNaN(t)}function s(t){return t.length}function h(t){return t.trim().replace(/\s+/g," ")}function g(t){for(var n=1;t*n%1;)n*=10;return n}function p(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}function d(t){return t.responseText}function m(t){return JSON.parse(t.responseText)}function v(t){var n=Li.createRange();return n.selectNode(Li.body),n.createContextualFragment(t.responseText)}function y(t){return t.responseXML}function M(){}function b(t){functio
[circus]
statsd = 1
stats_endpoint = tcp://127.0.0.1:5557
httpd = 1
httpd_host = 127.0.0.1
httpd_port = 8001
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
check_delay = 5
logoutput = logs/circus.log
@ewheeler
ewheeler / carData.csv
Last active December 19, 2015 06:09
central african republic choropleth
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 30 columns, instead of 11. in line 7.
prefecture,,,Status of RRM,Population (before emergency),Population (present),Population change,Number of Death (total),Number of Death under 5,Number of Injured (total),Number of Injured under 5,Number of hospital bed available,Medical staff Available (Yes),Medical staff Available (No),Medical Supply Available (Yes),Medical Supply Available (Partially),Medical Supply Available (No),survey1,survey2,survey3,survey4,survey5,survey6,survey7,survey8,survey9,survey10,survey11,survey12,survey13
Bangai,,,,371086,342425,-28661,105,0,209,11,432,20,5,12,13,0,42,,38,,,38,31,36,41,15,25,,25
Mbomou,,,,93000,93000,0,12,0,54,0,114,3,0,0,4,0,30,,26,22,,27,22,25,20,9,23,,21
Basse Kotto,,,,90430,90430,0,17,11,1,0,73,4,0,0,4,0,16,,16,,,14,7,10,3,2,14,,14
Kemo,,,,80859,78174,-2685,39,21,50%,0,53,0,2,1,13,0,15,,11,8,,7,1,7,1,0,14,,12
Ouham,,,,43000,70000,27000,3,1,5,0,120,4,5,0,9,0,15,,14,,,15,15,14,11,10,15,,15
Nana Mambere,,,,54487,50517,-3970,107,43,88,15,125,14,9,6,15,0,9,,1,1,,8,8,8,7,1,9,,9
Hautte Kotto,,,,50000,50000,0,,,,
@ewheeler
ewheeler / colorbrewer.js
Last active December 17, 2015 20:19
choropleth of poll topics in uganda
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@ewheeler
ewheeler / blueprint.js
Last active December 17, 2015 13:58
service blueprints
function drawHeader(){
Pablo.g({class: 'header', height: (rowHeight * headerSizeInRows), width: rowWidth})
.append(Pablo.rect({x: 0, y: 0, width: rowWidth, height: rowHeight, fill: '#92278F', 'fill-opacity': .9}))
.append(Pablo.rapidsms({x: 25, y: 10, scale: .55, rapidFill: '#FFFFFF', smsFill: '#FFFFFF'}))
.append(Pablo.text({'font-family': 'SilkscreenExpanded', class: 'header-tagline', x: 20, y: (rowHeight / 2) + 20, width: rowWidth, height: rowHeight, fill: '#FFFFFF'})
.attr('style', 'font-size: ' + (1 * scale) + 'em;')
.content(headerDescription))
.append(Pablo.rect({x: 0, y: rowHeight, width: rowWidth, height: (rowHeight * headerSizeInRows) - rowHeight, fill: '#DDD', 'fill-opacity': .9}))
.appendTo(paper);
}
@ewheeler
ewheeler / carto.tsv
Last active December 17, 2015 11:19
cartogram of survey results in Uganda
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 4 columns, instead of 5. in line 1.
name no unknown yes
Abim 13 31 68 0
Adjumani 11 27 84 0
Agago 23 41 102 0
Alebtong 18 28 57 0
Amolatar 12 24 66 0
Amudat 5 10 32 0
Amuria 10 21 115 0
Amuru 31 80 118 0
Apac 38 54 187 0
@ewheeler
ewheeler / colorbrewer.js
Last active August 2, 2016 09:44
choropleth of emergency cases in Rwanda
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@ewheeler
ewheeler / gist:2974886
Created June 22, 2012 20:07
capture client-side javascript errors and log to server
// for support before ECMA-262 5th edition ...
if (!Date.now) {
Date.now = function now() {
return +(new Date);
};
}
// keep track of how many errors have been logged to server
var num_errors = 0;
var max_errors = 10;
@ewheeler
ewheeler / gist:1262989
Created October 4, 2011 22:12
flask + tornado + nginx + supervisord
# create stub, then run flask app in tornado on port 5000 (perhaps with supervisord config below http://supervisord.org/index.html)
#!/usr/bin/env python
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myflaskapp import app
http_server = HTTPServer(WSGIContainer(app))
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import tweetstream
import datetime
import getpass
import sys
words = ["unicef", "innovation", "bunnies"]