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
FS = require 'fs' | |
express = require 'express' | |
joinPath = require( 'path' ).join | |
redis = require( 'redis' ).createClient() | |
RedisStore = require( 'connect-redis' )( express ) | |
server = express.createServer() | |
fetcher = require './fetcher' | |
# create "temp dir" | |
try FS.mkdirSync( joinPath( __dirname, '..','tmp' ) , 0755 ) catch ignore |
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
{"laughing":"http://s3.amazonaws.com/ragefaces/1304a2ba552f395b793a278dc6b232e1.png","funny":"http://s3.amazonaws.com/ragefaces/6bba77c8b9326aef8230886e16d66b0e.png","pftch":"http://s3.amazonaws.com/ragefaces/4f767454e72cef87d679c12823892356.png","victorious":"http://s3.amazonaws.com/ragefaces/b5140e11e5281ae31921bd53a39da08a.png","troll":"http://s3.amazonaws.com/ragefaces/0105be0f3197674f51bd013fbda84ecb.png","umad":"http://s3.amazonaws.com/ragefaces/fed47e7ffa874d01b771474d2eef1a60.png","trollface":"http://s3.amazonaws.com/ragefaces/1188b161991386e76f70a617220d95a6.png","problem":"http://s3.amazonaws.com/ragefaces/1188b161991386e76f70a617220d95a6.png","u jelly":"http://s3.amazonaws.com/ragefaces/1188b161991386e76f70a617220d95a6.png","jelly":"http://s3.amazonaws.com/ragefaces/1188b161991386e76f70a617220d95a6.png","fuck that":"http://s3.amazonaws.com/ragefaces/8874e57c4f330a8efe107b21aa2190ab.png","fuck":"http://s3.amazonaws.com/ragefaces/a3dc16a8264672738297dc924e36bbf7.png","fuckin":"http://s3.amazonaws.com |
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
Cross-browser, time-zone-aware parsing via JavaScript: | |
var s = "Fri Apr 09 12:53:54 +0000 2010"; | |
var date = new Date( | |
s.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, | |
"$1 $2 $4 $3 UTC")); | |
Tested on IE, Firefox, Safari, Chrome and Opera. |
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
HEXCHARS = '0123456789ABCDEF'.split('') | |
rgb2hex = (r,g,b)-> "##{byte2hex(r)}#{byte2hex(g)}#{byte2hex(b)}" | |
byte2hex = (n)-> String(HEXCHARS.substr((n >> 4) & 0x0F,1)) + HEXCHARS.substr(n & 0x0F,1) | |
hex2rgb = ( color )-> | |
triplet = color.toLowerCase().replace /#/ , '' | |
rgb = [] | |
if triplet.length is 6 | |
rgb[0] = parseInt(triplet.substr(0,2), 16) | |
rgb[1] = parseInt(triplet.substr(2,2), 16) | |
rgb[2] = parseInt(triplet.substr(4,2), 16) |
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
## | |
A seriously (if I may say so) kick-ass implementation of a dice notation reader in coffeescript. | |
Careful, it evals code, keep your strings clean before feeding them to this baby! (and adds a "d" method to Number) | |
## | |
Number::d = ( v )-> | |
[1..@].reduce ( a )-> | |
a + ( Math.floor( Math.random()*v ) + 1 ) | |
, 0 | |
Dice = ( dice )-> |
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 callForJS = $.ajax( { | |
complete: function( jqXhr ){ | |
var unsafeResponse = jqXhr.responseText | |
, empty = {}; | |
new Function( '', jqXhr.responseText ).call( empty ) // empty object as scope | |
} | |
} ); | |
// Safer, if you want to restrict access to some globals |
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 json; | |
json = [ | |
{ | |
foo: { | |
bar: ['ka', 'boom'] | |
} | |
}, { | |
foo: { | |
bar: ['sna', 'fu'] |
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 oscillator(low, high, inc) { | |
// basic test for illegal parameters | |
if (low > high || inc < 0 || 2 * (high - low) < inc) | |
return function() { return NaN; }; | |
var curr = low; | |
return function() { | |
var ret = curr; | |
curr += inc; |
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
{ | |
"hits": [], | |
"total_pages": 3, | |
"total": 72, | |
"count": 25, | |
"entries": [{ | |
"mention_in_reply_to_screen_name": "BadAssCoffeeRC", | |
"fetcher_type": "TwitterApiMention", | |
"pid": "mentions-twitter:3824990225", | |
"created_at": 1327367066, |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>{Title}</title> | |
<link rel='icon' href='{Favicon}'> | |
<link rel='shortcut icon' href='{Favicon}'> | |
<link rel='alternate' type='application/rss+xml' href='{RSS}'> | |
<meta name='description' content='{MetaDescription}'> | |
<meta name='color:Link' content='#6699cc'> |