Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| set background=dark | |
| hi clear | |
| if exists("syntax_on") | |
| syntax reset | |
| endif | |
| let colors_name = "twilight" |
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
});| # | |
| # $> ruby load.rb http://data.githubarchive.org/2012-04-01-15.json.gz | |
| # | |
| require 'yajl' | |
| require 'zlib' | |
| require 'sqlite3' | |
| require 'open-uri' | |
| input = ARGV.shift |
| var MixpanelLib = function (j, n, m) { | |
| function k(a, c, b) { | |
| if (a.length) { | |
| var e; | |
| for (e = 0; e < a.length; e++) c.call(b || c, a[e], e) | |
| } else if (typeof a == "object") for (e in a) Object.hasOwnProperty.call(a, e) && c.call(b || c, a[e], e) | |
| } | |
| function z(a, c) { | |
| a.prototype = new c; | |
| a.prototype.constructor = a; |
| // changed the functions from .keys() -> ._keys(), likewise for .values() | |
| // because .keys()/.values() breaks jQuery | |
| Object.prototype._keys = function (i) { | |
| var keys = Object.keys(this); | |
| return (i >= 0) ? keys[i] : keys; | |
| }; | |
| Object.prototype._values = function (i) { | |
| var self = this; |
| // https://gist.github.com/854622 | |
| (function(window,undefined){ | |
| // Prepare our Variables | |
| var | |
| History = window.History, | |
| $ = window.jQuery, | |
| document = window.document; | |
| // Check to see if History.js is enabled for our Browser |
| import email | |
| import email.parser | |
| import imaplib | |
| import getpass | |
| def imap_login(username=None, password=None): | |
| """ | |
| login and return the connection | |
| """ |
This histogram shows the distribution of GitHub Gist API response times (in milliseconds) for a sample of 10,000 requests as observed by bl.ocks.org.
The distribution roughly follows a log-normal distribution, which is unsurprising for a complex process that has multiple independently-random sources of delay. The mode response time was in the range 120-140ms, while the median response time was 206ms. The middle 80% of requests were in the range 114-527ms. About 11% of requests took longer than 500ms, and 5% of requests took longer than one second. (The rightmost bin in the histogram includes these long requests.)
Since API endpoints vary dramatically in their computational cost, the distribution of response times is likely multimodal. In this dataset, 96% of requests were for a single gist (/gists/42), while the remaining 4% of requests were to list a user’s gist (/users/fred/gists). By separating the API requests for a single