This file contains hidden or 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 fork = require('child_process').spawn; | |
| var cProcess = 0; | |
| bounds(0, 1000); | |
| function exec(param){ | |
| cProcess++; | |
| return fork(process.argv[0], [process.argv[2], param]); | |
| } | |
| function bounds(min, max) { |
This file contains hidden or 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 r = recurse(process.argv[2] || 5000, 0); | |
| console.log('found', r); | |
| function recurse(n, j) { | |
| if(n>0) return recurse(n-1, j+1); | |
| else return j; | |
| } |
This file contains hidden or 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 p = require('./program'); | |
| for(var dep in p) { | |
| global[dep] = p[dep]; | |
| } |
This file contains hidden or 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 mysqlConfigFromEnvironment (){ | |
| var dbUrl = process.env.DATABASE_URL; | |
| var parsed = url.parse(dbUrl); | |
| return { | |
| host: parsed.host, | |
| port: parsed.port || 3306, | |
| user: parsed.auth.split(':')[0], | |
| password: parsed.auth.split(":")[1] | |
| }; | |
| }; |
This file contains hidden or 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 aggregate_scores_by_lol = function(votes, lols, users){ | |
| var vote_count = lols.reduce(function(p,lol,i,r){ return p[lol.id] = 0, p; }, {}); | |
| var lol_dictionary = lols.reduce(function(p,lol,i,r){ return p[lol.id] = lol, p}, {}); | |
| votes.forEach(function(vote){ vote_count[vote.lol_id]++; }); | |
| var vote_count_keys = vote_count.map(function(el,ix){ return ix;}); | |
| var sorted_lol_ids = vote_count_keys.sort(function(a, b){ | |
| return vote_count[b] - vote_count[a]; |
NewerOlder