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 'benchmark' | |
require 'facets/dictionary' | |
require 'rbtree' | |
n = 1000000 | |
Benchmark.bm do |x| | |
@h = Hash.new | |
x.report("Hash insert") { n.times do @h[rand(n)] = 1 end } | |
x.report("Hash access") { n.times do @h[rand(n)] 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
# NOTE: See further development and a gem at http://github.com/topfunky/basic_model | |
require 'couchrest' | |
## | |
# A minimal class to help use CouchDB and CouchRest with Rails. | |
# | |
# Provides dot notation access for all attributes, one level deep. | |
# | |
# note.title |
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
# A Sinatra App as a Rails Plugin | |
# | |
# In your Edge Rails app: | |
# | |
# ruby script/plugin install git://gist.github.com/50625.git | |
require 'sinatra/base' | |
class SinatraRailsPlugin < Sinatra::Base |
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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
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
gem 'google-geocode', :version => '~> 1.2.1', :lib => 'google_geocode' | |
rake "gems:install" | |
plugin 'ym4r_gm', :svn => "svn://rubyforge.org/var/svn/ym4r/Plugins/GM/trunk/ym4r_gm" | |
puts "++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
puts "Note: ym4r_gm seems to have a problem with Rails 2.2." | |
puts "But it can be resolved easily: http://railsforum.com/viewtopic.php?id=24839" | |
puts "++++++++++++++++++++++++++++++++++++++++++++++++++++" |
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
plugin 'thinking-sphinx', :git => "git://github.com/freelancing-god/thinking-sphinx.git" | |
gem "RedCloth", :lib => "redcloth", :source => "http://code.whytheluckystiff.net" | |
rake "gems:install" | |
#private URL | |
plugin 'tog_conversatio', :git => "[email protected]:cauta/tog_conversatio.git" | |
#public url | |
#plugin 'tog_conversatio', :git => "git://github.com/cauta/tog_conversatio.git" | |
route "map.routes_from_plugin 'tog_conversatio'" |
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
run "gem sources -a http://gems.github.com" | |
gem 'desert', :version => '0.5', :lib => 'desert' | |
gem 'mislav-will_paginate', :version => '~> 2.3.6', :lib => 'will_paginate', :source => 'http://gems.github.com' | |
gem 'tog-tog', :version => '0.4.4', :lib => 'tog' | |
rake "gems:install" | |
plugin 'acts_as_commentable', :svn => "http://juixe.com/svn/acts_as_commentable" | |
file "db/migrate/" + Time.now.strftime("%Y%m%d%H%M%S") + "_acts_as_commentable.rb", | |
%q{class ActsAsCommentable < ActiveRecord::Migration |
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
Deploying a Rails App with EC2 + S3 + Ubuntu | |
============================================ | |
Create EC2 Instance | |
------------------- | |
create new instance ami-bf5eb9d6 [http://alestic.com/](http://alestic.com/) | |
create new elastic ip | |
attach elastic ip to instance | |
point dns to elastic ip |