Skip to content

Instantly share code, notes, and snippets.

View wombleton's full-sized avatar

Rowan Crawford wombleton

View GitHub Profile
(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);
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
@wombleton
wombleton / output.json
Created October 17, 2014 04:49
OIA requests on FYI from 2010 to 1 Oct 2014
{"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
@wombleton
wombleton / oia performance.txt
Created October 17, 2014 08:30
Summary of OIA requests to Ministers/Ministries on fyi.org.nz
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 / generateId.js
Created February 5, 2010 00:36
jquery generateId that preserves existing ids and guesses appropriate prefixes, similar to Ext's id()
$.extend((function() {
var counts = {};
return {
generateId: function(prefix) {
prefix = (prefix || 'jq') + '-';
counts[prefix] = counts[prefix] || 0;
return prefix + counts[prefix]++;
}
}
})());
@wombleton
wombleton / timezones.rb
Created September 28, 2010 01:39
Create timezone transition data from the list of timezones in the "zones" variable. Depends on the installed ruby's Olson data being accurate.
require 'rubygems'
require 'tzinfo'
require 'json'
# Run to generate Olson => goog.i18n.TimeZone data.
zones = %w(UTC Pacific/Auckland)
FIFTY_YEARS_FROM_NOW = DateTime.now + 365 * 50
MINUTES_IN_HOUR = 60
@wombleton
wombleton / reply-to.js
Created November 12, 2010 22:18
Public Address In-Reply-To Improve
$('.reply-to').live('click', function() {
var hash = ($(this).attr('href') || '').split('#')[1];
if ($('#' + hash).length && hash) {
window.location.hash = hash;
return false;
}
});
@wombleton
wombleton / publicip.js
Created April 6, 2011 05:11
ExtJS VType For Public IP Addresses Complying With RFC 1918
Ext.apply(Ext.form.VTypes, {
publicip: function(v) {
var errorMessage = 'Invalid public IP address',
i,
parts = [];
v = Ext.util.Format.trim(v || '').split('.');
for (i = 0; i < v.length; i++) {
var num = parseInt(v[i]);
if (Ext.isNumber(num) && num >= 0 && num <= 255) {
parts.push(num);
@wombleton
wombleton / jquery.toobject.coffee
Created May 11, 2011 12:55
coffeescript jquery plugin converting a form element to a json object. based on form2object.js
###
Copyright (c) 2010 Maxim Vasiliev, Rowan Crawford
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@wombleton
wombleton / Ajax.Pjaxer.js
Created May 30, 2011 22:31
Prototype Pjax
/** Untested */
Ajax.Pjaxer = Class.create(Ajax.Updater, {
initialize: function($super, container, url, options) {
options = Object.clone(options);
options.headers = options.headers || {};
Object.extend(options.headers, {
'X-PJAX': 'true'
});
var onComplete = options.onComplete;