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 'tweets' | |
run Sinatra::Application |
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 '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 |
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 '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 |