Skip to content

Instantly share code, notes, and snippets.

@guyon
guyon / gist:338663
Created March 20, 2010 13:16 — forked from kenn/gist:338351
require 'tweets'
run Sinatra::Application
@guyon
guyon / gist:338662
Created March 20, 2010 13:16 — forked from kenn/gist:338337
require 'rubygems'
require 'sinatra'
require 'em-http'
require 'json'
get '/tweets' do
content_type 'text/html', :charset => 'utf-8'
TWEETS.map {|tweet| "<p><b>#{tweet['user']['screen_name']}</b>: #{tweet['text']}</p>" }.join
end
@guyon
guyon / forky.rb
Created March 20, 2010 13:15 — forked from ujihisa/forky.rb
require 'drb'
# Forky(enum) {|e| something(e) }
# almost same as
# enum.each {|e| something(e) }
# but each block runs on other processes without using thread.
#
# 1. Forky makes flags
# 2. Forky starts DRb server which only has flags
# 3. Forky runs each process asynchronously which process make the flag true after the process finished