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
require 'iconv' | |
def shift | |
line = '' | |
in_quote = 0 | |
loop do | |
if read_line = $stdin.gets("\n") | |
line += read_line.chomp | |
else | |
return nil |
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
# Input - Lunch Records | |
# { "date": "10-25-2011", "tasty": true, "food": "pizza", "restaurant": "Antico Pizza" } | |
# { "date": "10-24-2011", "tasty": true, "food": "tacos", "restaurant": "Taqueria del Sol" } | |
# { "date": "10-23-2011", "tasty": false, "food": "wings", "restaurant": "Wing Nuts" } | |
# { "date": "10-22-2011", "tasty": true, "food": "sandwiches", "restaurant": "Super Pan" } | |
# { "date": "10-22-2011", "tasty": true, "food": "pizza", "restaurant": "Fellini's Pizza" } | |
class TastyMapper < Wukong::Streamer::LineStreamer | |
def process(line) | |
lunch = JSON.parse(line) |
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
= | |
/\/\/\/\ -------- | |
< > | | | |
< > --> | | | |
< > --> | | | |
< > | | | |
\/\/\/\/ -------- | |
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
apply = if Prototype.Browser.IE | |
(o, a) -> | |
a or= [] | |
switch a.length | |
when 0 then return @call o | |
when 1 then return @call o, a[0]# shreddin' the argument powder | |
when 2 then return @call o, a[0], a[1]# \__O_/ | |
when 3 then return @call o, a[0], a[1], a[2]# | | |
when 4 then return @call o, a[0], a[1], a[2], a[3]# \ /\ | |
when 5 then return @call o, a[0], a[1], a[2], a[3], a[4]# \ / |
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
#!/usr/bin/env bash | |
WD=`pwd` | |
tiger_em () { | |
directory=$WD/$1 | |
shift | |
until [ -z "$1" ] | |
do | |
get_em $directory "ftp://ftp2.census.gov/geo/tiger/TIGER2010/"$1 | |
shift |
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 Point = function(x, y){ | |
if(_.isUndefined(y)){ | |
var arr = x.slice(); | |
x = arr.shift(); | |
y = arr.shift(); | |
} | |
this.x = (x || 0); | |
this.y = (y || 0); | |
}; | |
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 repeat(n) { return (new Array(n)).join(" "); } | |
function format(json){ | |
var chars = json.split("") | |
, inString = false | |
, formatted = "" | |
, tabCount = 1 | |
; | |
chars.forEach(function(chr){ | |
switch(chr) | |
{ |
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
if Stat.exists? :url => url, :date_for => date_for | |
stat = Stat.first(:conditions => {:url => url, :date_for => date_for}) | |
self.id = stat.id | |
new_hits = hits | |
reload | |
@new_record = false | |
errors.clear | |
increment(:hits, new_hits) | |
end |
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
.infinite_frowns { | |
color: #660000; | |
background: #FFEEEE; | |
} | |
.infinite_smiles { | |
color: #000; | |
background: #CCFFCC; | |
} |
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
backend app1 { | |
.host = "1.1.1.1"; | |
.port = "80"; | |
} | |
backend app2 { | |
.host = "2.2.2.2"; | |
.port = "80"; | |
} |