Skip to content

Instantly share code, notes, and snippets.

@andrewn
andrewn / gist:3715053
Created September 13, 2012 15:22
Useful d3 links
def hash_to_ostruct(object)
return case object
when Hash
object = object.clone
object.each do |key, value|
object[key] = hash_to_ostruct(value)
end
OpenStruct.new(object)
when Array
object = object.clone
@andrewn
andrewn / grid.js
Created January 11, 2012 14:05 — forked from andrewn/grid.js
GEL bookmarklet
javascript:if(document.createElement && document.childNodes){var bm = document.createElement('script');var head = document.getElementsByTagName('head')[0];head.appendChild(bm);bm.setAttribute('src', 'https://raw.github.com/gist/1594792/grid.js');}else{alert('Sorry, your browser cannot do this')}
var Logging = (function () {
function create(source) {
function F() {}
F.prototype = source;
return new F();
};
var LoggerBase = function (opts) {
var opts = opts || {};
# From: http://www.mcqn.com/cgi-bin/weeknotecalc
def weeknote_week(this_week)
registration_date = Date.civil(2010,3,29)
# Get the start of the week for each of those dates
if registration_date.wday == 0
# wday of 0 is Sunday, and we want our weeks to start on Monday
registration_date = registration_date - 6
else
registration_date = registration_date - (registration_date.wday - 1)
@andrewn
andrewn / gist:1259583
Created October 3, 2011 16:52
stats systems
http://piwik.org/features/
http://www.openwebanalytics.com/
iStats?
@andrewn
andrewn / grid.js
Created September 14, 2011 18:53
GEL bookmarklet
javascript:if(document.createElement && document.childNodes){var bm = document.createElement('script');var head = document.getElementsByTagName('head')[0];head.appendChild(bm);bm.setAttribute('src', 'https://raw.github.com/gist/1217428/grid.js');}else{alert('Sorry, your browser cannot do this')}
function setCacheMaxAge($ageInSecs)
{
$this->blq->setContentMaxAge($ageInSecs);
$this->blq->setIsUK(true);
$this->blq->setShowAdverts(false);
$this->blq->setCountry('uk');
$this->blq->setContentCacheability('public');
}
~$ traceroute 192.168.192.10
traceroute to 192.168.192.10 (192.168.192.10), 64 hops max, 52 byte packets
1 * * *
traceroute: sendto: No route to host
2 traceroute: wrote 192.168.192.10 52 chars, ret=-1
*traceroute: sendto: Host is down
traceroute: wrote 192.168.192.10 52 chars, ret=-1
*traceroute: sendto: Host is down
traceroute: wrote 192.168.192.10 52 chars, ret=-1
*