👨👩👧👦
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
def import(stat, &blk) | |
puts "trying #{stat}" | |
begin | |
block_given? ? blk.call : Object.const_get(stat).import(@date) | |
rescue GatticaError => exception | |
puts "*** got a GA error: #{exception} ***" | |
sleep 10 | |
retry | |
end | |
end |
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
require 'rubygems' | |
require 'pp' | |
unless self.class.const_defined? "IRB_RC_HAS_LOADED" | |
# Log to STDOUT if in Rails | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
end |
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
#! /bin/sh | |
# | |
# usat_import | |
# Created by Ryan Nagle, Chris Groskopf and Brian Boyer | |
# | |
# PostgreSQL importer for the pre-processed census files provided to IRE | |
# members by Paul Overberg and Anthony DeBarros from USA Today. | |
# | |
# To get the source files, join IRE (it's cheap!): | |
# http://www.ire.org/getcensus/ |
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
// First things first, add our special CSRF token to every jQuery Ajax | |
// request. | |
$(document).ajaxSend(function(e, xhr, options) { | |
var token = $("meta[name='csrf-token']").attr("content"); | |
xhr.setRequestHeader("X-CSRF-Token", token); | |
}); |
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
class TweetClassifier | |
GOOD = %w[superior quality excellent superb outstanding magnificent | |
great exceptional marvelous wonderful awesome] | |
BAD = %w[inferior shoddy careless miserable horrible | |
incompetent awful atrocious terrible pathetic crappy] | |
FACETS = %w[article story piece column] | |
SEARCH = "http://search.twitter.com/search.json" | |
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
read -a choices <<<'Agnes Kathy Princess Vicki Victoria Bruce Fred Junior Ralph Albert Bahh Bells Boing Bubbles Cellos Deranged Hysterical Trinoids Whisper Zarvox'; n=${#choices[*]}; voice=${choices[$((RANDOM%n))]}; curl https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=wmhartnett | grep '<description>.*</description>' | sed -e 's/<\/*description>//g' -e 's/ \/ wmhartnett//g' -e 's/wmhartnett: //g' | say -v $voice |
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
MAKEFILE=$(lastword $(MAKEFILE_LIST)) | |
REMOTE?=$(REMOTE_USER)@$(REMOTE_HOST) | |
REMOTE_SSH?=ssh -p $(REMOTE_PORT) | |
REMOTE_SHELL?=$(REMOTE_SSH) $(REMOTE) $(REMOTE_LOGIN) | |
REMOTE_MAKE?=cat $(MAKEFILE) | $(REMOTE_SHELL) make -f /dev/stdin -C $(REMOTE_BASE) | |
# LOCAL COMMANDS: | |
hello: |
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
$ curl -I http://t.co/a87DAaC | |
HTTP/1.1 301 Moved Permanently | |
Date: Sat, 20 Aug 2011 22:53:39 GMT | |
Server: hi | |
Location: http://nyti.ms/p8ZGNT | |
Cache-Control: private,max-age=300 | |
Expires: Sat, 20 Aug 2011 22:58:39 GMT | |
Connection: close | |
Content-Type: text/html; charset=UTF-8 |
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
// Demonstration of dynamic super() calls. | |
// Because of JS reserved words, "ssuper()" is the method name, | |
// and is passed the current object, as well as the name of | |
// the current method. | |
function GreatGrandParent() {}; | |
GreatGrandParent.prototype.method = function() { | |
console.log("In the GreatGrandParent."); | |
}; |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Mercator craziness</title> | |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript">//<![CDATA[ | |
var map; | |
var circles = []; | |
function degToRad(degrees) {return degrees * Math.PI / 180;} |