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
$ sudo apt-get install build-essential zlib1g zlib1g-dev libruby1.9.1 libxml2 libxml2-dev libxslt1-dev | |
$ sudo apt-get build-dep ruby1.9.1 | |
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2 | |
$ tar xvjf ruby-1.9.2-p0.tar.bz2 | |
Open ruby-1.9.2-p0/ext/Setup and uncomment the zlib line | |
$ ./configure | |
$ make |
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
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
require 'foo' | |
run Foo |
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
- nav.each do |item| | |
- item.each do |name, href| | |
%li{:href => href}= name |
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 'ponder' | |
# simulating a very simple queue | |
@queue = [] | |
Thread.new do | |
loop do | |
@queue << rand(10000).to_s | |
sleep 5 | |
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
resources :users do | |
# /users/:id/confirm_email(.:format) | |
# confirm_mail_user_path | |
get :confirm_email, :on => :member | |
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
= link_to(posts_path) do | |
%u foo | |
%i bar | |
%b baz |
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
#friend_list | |
#scrolling_list | |
- (1..5).each do |i| | |
.friend_summary | |
%img{:src => "images/friend-default.png"} |
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
%foo> | |
%br | |
%bar |
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 'haml' | |
require 'sinatra/base' | |
class Application < Sinatra::Base | |
configure do | |
enable :static | |
set :views, File.join(File.dirname(__FILE__), 'views') | |
set :public, File.join(File.dirname(__FILE__), 'public') | |
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
- cars.each_with_index do |car, index| | |
%p{:class => car, :id => "car_#{index + 1}"} |