Skip to content

Instantly share code, notes, and snippets.

@doubleshow
Created September 15, 2014 12:08
Show Gist options
  • Save doubleshow/dffc8ee93ba17c1b1051 to your computer and use it in GitHub Desktop.
Save doubleshow/dffc8ee93ba17c1b1051 to your computer and use it in GitHub Desktop.
Template for a program to grab all the events about a repository
var GitHubApi = require("github");
var async = require("async");
var github = new GitHubApi({
// required
version: "3.0.0",
// optional
timeout: 5000
});
function getClassEventsForPage(i, callback){
// TODO:
};
// [ [a,a,a], [b,b,b], ... ] -> [a,a,a,b,b,b, ... ]
function flatten_fast(input){
// TODO: Use a faster implementation
// (ref: http://jsperf.com/flatten-an-array-loop-vs-reduce)
}
async.map([/* TODO */], getClassEventsForPage, function(err, results){
// TODO: This must be implemented
flattened = flatten_fast(results);
console.log(JSON.stringify(flattened, undefined, 4));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment