View ddp_log.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var monkeyPatches = { | |
'_livedata_data': 'DATA', | |
'_livedata_error': 'ERROR', | |
'_livedata_nosub': 'NOSUB', | |
'_livedata_connected': 'CONNECTED', | |
'_livedata_result': 'RESULT', | |
}; | |
_.each(_.keys(monkeyPatches),function(funcName){ | |
var modifiedFunctionName = funcName+'_original'; | |
var extension = {}; |
View Meteor local mirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//common to client and server | |
SharedCollection = new Meteor.Collection('shared'); | |
//client from here on out | |
LocalMirror = new Meteor.Collection(null); | |
var convertSharedToLocal = function(sharedDoc) { | |
var localDoc = LocalCollection._deepcopy(sharedDoc); // undocumented API, might change |
View loadTiming.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(), | |
system = require('system'), | |
startTime, address, requestStartTimes, requestDurations; | |
if (system.args.length === 1) { | |
console.log('Usage: netlog.js <some URL>'); | |
phantom.exit(1); | |
} | |
address = system.args[1]; |
View location.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Location = {}; | |
this.Location = Location; | |
Location.dep = new Deps.Dependency; | |
Location.state = window.history.state; | |
window.onpopstate = function(event){ | |
Location.state = event.state; | |
// note that popstate gets fired on initial page load in Webkit, |
View get-from-bucket.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
filenames = [ | |
'doxygenConfig', | |
'firstExample', | |
'secondExample', | |
'SConstruct', | |
'mongod', | |
'mongo', | |
'mongodump', |
View long_to_bytes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def long_to_bytes(n): | |
l = [] | |
x = 0 | |
off = 0 | |
while x != n: | |
b = (n >> off) & 0xFF | |
l.append( b ) | |
x = x | (b << off) | |
off += 8 | |
l.reverse() |
View gray.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gray(n): | |
if n == 1: | |
return ["0", "1"] | |
originals = gray(n - 1) | |
prefixedOriginals = ["0" + d for d in originals] | |
reflected = list(reversed(originals)) | |
prefixedReflected = ["1" + d for d in reflected] | |
return prefixedOriginals + prefixedReflected |
View handgrenade.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HandGrenadeError: pass | |
class WrongNumberError(HandGrenadeError): pass | |
class HolyHandGrenade: | |
def reference(self): | |
return "Armaments, chapter two, verses nine through twenty-one." | |
def lob(self, number): | |
if number != 3: |
View Tiling.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
def downsample(im): | |
return im[::2, ::2, :] | |
def smoothIm(im, kernelSize=5): | |
return cv2.GaussianBlur(im, (kernelSize, kernelSize), 0) |
View hoon.kak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Detection | |
# | |
hook global BufCreate .*[.](hoon) %{ | |
set buffer filetype hoon | |
} | |
# Highlighters & Completion | |
# |
OlderNewer