Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
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 }
# 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
@lgs
lgs / init.rb
Created April 21, 2009 21:10 — forked from jnewland/init.rb
# 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
require 'sinatra/metal'
class SinatraMetal < Sinatra::Base
include Sinatra::Metal
get '/sinatra' do
'hello sinatra!'
end
end
require 'sinatra/metal'
class SinatraMetal < Sinatra::Base
include Sinatra::Metal
get '/sinatra' do
'hello sinatra!'
end
end
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 "++++++++++++++++++++++++++++++++++++++++++++++++++++"
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'"
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
We couldn’t find that file to show.
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