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 debug_dict(self, debug_message, data_dict): | |
import logging | |
info = '%s\n' % debug_message | |
for k, v in sorted(data_dict.iteritems()): | |
info += '%s: %s\n' % (k, v) | |
logging.debug(info) |
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
function convertTableToCsv(tableSelector) { | |
return _.map($(tableSelector + ' tr'), function(row) { | |
return _.map($(row).find('th, td'), function(datum) { | |
return datum.textContent.replace(/,/g, ''); | |
}).join(','); | |
}).join('\n'); | |
} | |
// to download | |
var data = convertTableToCsv('#mytable'); |
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
function r() { | |
return Math.random() * 100; | |
} | |
var lineData = function() { | |
return [ | |
[0, r()], | |
[20, r()], | |
[40, r()], | |
[60, r()], |
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
taken directly from https://sites.google.com/a/khanacademy.org/forge/for-developers/code-review-policy/using-phabricator | |
Advanced topic: Dependent Phabricator reviews | |
Say you have an upstream called master, and a feature branch F1, and a second change that depends on F1, (call it F2). | |
git checkout master | |
git checkout -b F1 | |
# work work | |
git commit -a | |
arc diff |
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
#!/usr/bin/env python | |
import msgpack | |
import sys | |
try: | |
while True: | |
line = sys.stdin.readline().strip('\n') | |
try: | |
print msgpack.unpackb(line) |
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
(require '[clojure.core.memoize :as memo]) | |
(defn calc [x] x) | |
(def memo-calc (memo/ttl calc {} :ttl/threshold 13)) | |
(filter #(not= "ok" %) | |
(for [x (range 100000)] | |
(if (nil? (memo-calc "abc")) | |
(println "Result was nil!") |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
OlderNewer