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]; |
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 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
| 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 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
| function throwup(fxn) { | |
| return function() { | |
| throw [fxn, Array.prototype.slice.call(arguments)]; | |
| } | |
| } | |
| function makecallable(fxn) { | |
| return function() { | |
| var params = Array.prototype.slice.call(arguments); | |
| while(params) { |
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 throwup = require('throw').throwup, makecallable = require('throw').makecallable; | |
| var recurse = throwup(_recurse); | |
| var callable_recurse = makecallable(_recurse); | |
| var result = callable_recurse(parseInt(process.argv[2], 10) || 5000, 0); | |
| console.log('found', result); | |
| 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 throwup = require('throw').throwup, makecallable = require('throw').makecallable; | |
| var even = throwup(_even), | |
| odd = throwup(_odd); | |
| var r = makecallable(_even)(parseInt(process.argv[2], 10) || 5000, 0); | |
| console.log('found2', r); | |
| function _even(n,j) { | |
| if(n>0) return odd(n-1, j+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
| - return HttpResponse(simplejson.dumps(data), mimetype="application/json") | |
| + | |
| + # The Django Session middleware helpfully adds 'Cookie' to the Vary header if request.session.accessed is true | |
| + # Firefox won't cache JSON if the response varies by cookie. | |
| + # Since we mark Cache-Control: private and max-age:60, the attack vector here is very very small: | |
| + # People on the same machine as the victim, who read the cache within 60 seconds | |
| + # So, let's fake out the session middleware to not send the Vary: Cookie header, just Vary: Accept-Encoding. | |
| + request.session.accessed = False | |
| + | |
| + response = HttpResponse(simplejson.dumps(data), mimetype="application/json; charset=utf-8") |
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
| // [true, true, true]: | |
| [ | |
| 0 === -0, | |
| Math.atan2(0, -0) === Math.PI, | |
| Math.atan2(0, 0) === 0 | |
| ] | |
| // [false, false]: | |
| [ | |
| -0 < 0, |
OlderNewer