Skip to content

Instantly share code, notes, and snippets.

Avatar

Rowan Crawford wombleton

View GitHub Profile
View heroku explain
$> db.tiles.find({}).sort({ 'voteCount': 1, 'hash': 1}).skip(1000).limit(10).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "heroku_app35335042.tiles",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [ ]
},
"winningPlan" : {
@wombleton
wombleton / oia performance.txt
Created Oct 17, 2014
Summary of OIA requests to Ministers/Ministries on fyi.org.nz
View oia performance.txt
At Aug 2010 over the last six months there were 0 outstanding requests were out of 2.
The median processing time for completed requests was 34 working days.
The average processing time was 34.0 working days.
At Sep 2010 over the last six months there were 0 outstanding requests were out of 1.
The median processing time for completed requests was 22 working days.
The average processing time was 22.0 working days.
At Oct 2010 over the last six months there were 0 outstanding requests were out of 1.
The median processing time for completed requests was 22 working days.
@wombleton
wombleton / output.json
Created Oct 17, 2014
OIA requests on FYI from 2010 to 1 Oct 2014
View output.json
{"site":"https://fyi.org.nz","from":"2010-01-01","to":"2014-10-01","requests":[{"created_at":"2010-03-22T10:57:56.000Z","title":"Value of Crown mining royalties","url":"https://fyi.org.nz/request/value_of_crown_mining_royalties_2","status":"success","elapsed_time":35,"timeline":"2010-03-22 - 2010-05-11","body":"Department of Conservation","body_url":"https://fyi.org.nz/body/doc"},{"created_at":"2010-03-22T11:00:21.000Z","title":"Value of Crown mining royalties","url":"https://fyi.org.nz/request/value_of_crown_mining_royalties","status":"success","elapsed_time":33,"timeline":"2010-03-23 - 2010-05-10","body":"Ministry of Economic Development","body_url":"https://fyi.org.nz/body/med"},{"created_at":"2010-09-16T22:18:58.000Z","title":"Amount of time a person/s has been involved in a court/ tribunal hearing","url":"https://fyi.org.nz/request/amount_of_time_a_persons_has_bee","status":"rejected","elapsed_time":22,"timeline":"2010-09-17 - 2010-10-18","body":"Ministry of Justice","body_url":"https://fyi.org.nz/body/m
View gist:e8e229c79400ad5bc1ad
2014-07-30 10:05:17 status installed linux-headers-3.2.0-41-generic 3.2.0-41.66
2014-07-30 10:05:19 status installed linux-headers-3.2.0-41 3.2.0-41.66
2014-07-30 10:05:20 status installed linux-headers-3.2.0-59-generic 3.2.0-59.90
2014-07-30 10:05:22 status installed linux-headers-3.2.0-59 3.2.0-59.90
2014-07-30 10:05:23 status installed linux-headers-3.2.0-61-generic 3.2.0-61.93
2014-07-30 10:05:25 status installed linux-headers-3.2.0-61 3.2.0-61.93
2014-07-30 10:05:27 status installed linux-headers-3.2.0-63-generic 3.2.0-63.95
2014-07-30 10:05:28 status installed linux-headers-3.2.0-63 3.2.0-63.95
2014-07-30 10:05:29 status installed linux-headers-3.2.0-64-generic 3.2.0-64.97
2014-07-30 10:05:31 status installed linux-headers-3.2.0-64 3.2.0-64.97
View throatwhistle.js
(function() {
var container = document.createElement('div'),
el;
container.innerHTML = '<iframe width="420" height="315" src="//www.youtube.com/embed/u8drRfc69NA?autoplay=1&start=7" frameborder="0" allowfullscreen style="position:fixed;top:20px;left:50%;margin-left:-210px;z-index:10000"></iframe>';
el = container.children[0];
document.body.appendChild(el);
function remove() {
document.body.removeChild(el);
View validation.js
var obj = {
name: 'Good McGoodson',
last_menstrual_period: 41
};
validate(obj, [ "name.length between 1 and 100", "lmp between 0 and 40"]]); // returns ["lmp must be between 0 and 40"]
@wombleton
wombleton / sha.js
Last active Dec 18, 2015
Node & command line differ in hash they return ... what am I doing wrong?
View sha.js
// \n at the end!
console.log(require('crypto').createHash('sha1').update('blob 14\0Hello, World!\n').digest('hex'));
$> 8ab686eafeb1f44702738c8b0f24f2567c36da6d
View sparkle-science.css
body {
font-family: "Helvetica", "sans-serif";
width: 400px;
float: left;
}
#banner {
background: #f7b;
color: #fff;
padding: 1px;
View gist:3990618
var express = require('express'),
app = express();
app.configure(function() {
app.use(express.bodyParser());
});
/**
*/
app.get('/', function (req, res) {
@wombleton
wombleton / xkcd.js
Created Sep 19, 2012
xkcd.com large comic navigation
View xkcd.js
// Paste this in the address bar and then use zoom in/out to navigate easier
// you may need to type in "javascript:" in the address bar manually
javascript:$('#comic').css('overflow', '');$('#topContainer, #bottom, .comicNav, #comic > img:first-child').hide()
// firefox does not allow you to do this from the address bar. For that, open the Scratchpad (Shift + F4) and execute:
$('#comic').css('overflow', '');$('#topContainer, #bottom, .comicNav, #comic > img:first-child').hide()