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
function city_map() { | |
emit({state:this.state, city:this.city}, {zips:1, pop:this.pop}); | |
} | |
function city_reduce(key, values) { | |
out = {zips:0, pop:0}; | |
values.forEach(function (val) { | |
out.zips += val.zips; | |
out.pop += val.pop; | |
}); |
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
source 'http://rubygems.org' | |
#gem 'rails', '3.0.0.beta3' | |
# Bundle edge Rails instead: | |
gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => 'master' | |
# Use unicorn as the web server | |
# gem 'unicorn' |
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
-module(base36). | |
-export([encode/1]). | |
encode(Input)-> | |
encode(Input, ""). | |
encode(Input, Encoded) -> | |
if Input > 36 -> | |
E = lookup(Input rem 36), | |
encode(Input div 36,[E|Encoded]); |
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 TwitterFetcher | |
def perform | |
api = IndexTank::Client.new(ENV['INDEXTANK_API_URL'] || index_tank_url) | |
index = api.indexes 'idx' | |
streaming_url = 'http://stream.twitter.com/1/statuses/sample.json' | |
EventMachine.run do | |
http = EventMachine::HttpRequest.new(streaming_url).get :head => { 'Authorization' => [ TWITTER_USERNAME, TWITTER_PASSWORD ] } |
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.tweets.update({}, {'$unset' : {'reply_count' :1}}, false, true) |
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 ApplicationController < ActionController::Base | |
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found | |
private | |
def record_not_found | |
render :text => "404 Not Found", :status => 404 | |
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
class TestOne | |
def initialize(logger) | |
@logger = logger | |
end | |
def load_doc | |
begin | |
@logger.debug('Starting Document load') | |
@doc = Document.load('resume.txt') |
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 'rspec' | |
require 'koala' | |
describe "new stuff" do | |
before do | |
@graph = Koala::Facebook::API.new("AAACNTDIeX5MBAEZCdoXPE7nsltT3tVuqiCassXFqRzU2uBb1hTdZBtT3kq2YNcsnJOlsZAqRpmi8wZDZD") | |
end | |
describe "hiding page posts" do |
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 instantiate the graph api with our access token | |
@graph = Koala::Facebook::API.new("ACFTHNIWeX5MBAEZCdoXPE7nsltT3tVuqiVoKCIO0CassXFqRzU2uBb1htT3kq2YNcsnJOlsZAqRpmi8wZDZD") | |
#retrieve a page's milestones | |
milestones = @graph.get_connection("256490626309681", "milestones") |
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
args = {:title => "Example Title", :description => "Description", :start_time => "1329417443"} | |
milestone = @graph.put_connections("256490621109681", "milestones", args) |
OlderNewer