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
✱ ryan ~ master ♥ | |
✱ curl -u MY_EMAIL -sSNT test.js "testling.com/?browsers=iexplore/7.0,iexplore/8.0,chrome/13.0" | |
Enter host password for user 'MY_EMAIL': | |
iexplore/7.0: | |
curl: (18) transfer closed with outstanding read data remaining | |
✱ ryan ~ master ♥ | |
✱ |
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
/** | |
* STRENGTH! | |
*/ | |
Object.prototype.toString = Array.prototype.toString = undefined; | |
/** | |
* Now operators will throw an exception when attempting | |
* to convert objects & arrays to a string! | |
*/ | |
[] + {}; // nope |
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
db.eval(function (str) { | |
return db.foo.find({$where: function () { | |
return str.match(this.regexp); | |
}); | |
}, "match this"); |
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
var results = _.reduce({ | |
marissa: {pho: 0, thai: 1, rauls: 1, racoon: 0.5}, | |
robert: {pho: 0, thai: 0.5, rauls: 1, racoon: 1}, | |
david: {pho: 1, thai: 0.8, rauls: 0.1, racoon: 0.6}, | |
tyler: {pho: 0.4, thai: 0.3, rauls: 0.7, racoon: 0.6}, | |
ryan: {pho: 0.8, thai: 0.8, rauls: 0.8, racoon: 0.6} | |
}, function (a, b) { | |
return { | |
pho: a.pho + b.pho, | |
thai: a.thai + b.thai, |
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
:a: :b: |
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
/** | |
* Check if email is inuse. | |
* @url /user/login | |
* @request { | |
* {String} email | |
* } | |
* @response { | |
* {Boolean} email_in_use | |
* } | |
* @error server Internal server error |
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
var choice1 = prompt("Do you choose rock, paper or scissors?"); | |
var choice2 = Math.random(); | |
if (choice2 <0.34){ | |
choice2 = "rock"; | |
}else if(choice2 <=0.67){ | |
choice2 = "paper"; | |
}else{ | |
choice2 = "scissors"; | |
} |
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
import ast | |
import json | |
import operator as op | |
import inspect | |
f = open(inspect.getfile(inspect.currentframe())) | |
code = ast.parse(f.read()) | |
def tab_over(code): | |
return '\n'.join([' ' + line for line in \ |
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
#include <stdio.h> | |
#include <sys/time.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <math.h> | |
// http://www.kernel.org/doc/man-pages/online/pages/man2/clock_gettime.2.html | |
uint64_t microtime() { | |
struct timeval start; |
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
route('/games', function (req) { | |
return mongo('game'); | |
}); | |
// @TODO Write that pf library! | |
route('/games', pf.lazy(mongo, 'game')); |