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
# fast way to include too many stylesheets | |
def include_stylesheets | |
sheets = %w(dropdown style calendar/red/style facebox) | |
sheets.inject(""){ |string, sheet| string << stylesheet_link_tag(sheet) } | |
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
# fast way to include too many stylesheets | |
def include_stylesheets | |
sheets = %w(dropdown style calendar/red/style facebox) | |
sheets.inject(""){ |string, sheet| string << stylesheet_link_tag(sheet) } | |
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
# fast way to include too many stylesheets | |
def include_stylesheets | |
sheets = %w(dropdown style calendar/red/style facebox) | |
sheets.inject(""){ |string, sheet| string << stylesheet_link_tag(sheet) } | |
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
$ ./script/console | |
Loading development environment (Rails 2.1.0) | |
>> include ActionView::Helpers::UrlHelper | |
=> Object | |
>> include ActionController::UrlWriter | |
=> Object | |
>> default_url_options[:host] = "foo" | |
=> "foo" | |
>> url_for(:controller => 'graphs', :action => 'delivery', :only_path => false, :start_date => "1", :end_date => "1") | |
=> "http://foo/admin/graphs/delivery?end_date=1&start_date=1" |
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
#menu | |
- menu_item "Compañía" do | |
= menu_link("Medellin", page_path("1")) | |
= menu_link("Misión", page_path("2")) | |
= menu_link("Visión", page_path("3")) | |
= menu_link("Valores", page_path("4")) | |
- menu_item "Nuestros Servicios" do | |
= menu_link("Interpretación", service_path("1")) | |
= menu_link("Arrendamiento Apartamentos", service_path("7")) |
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
# Backup database | |
namespace :db do | |
desc "Backup the remote production database" | |
task :backup, :roles => :db, :only => { :primary => true } do | |
mysql_password = Capistrano::CLI.password_prompt("Production MySQL password: ") | |
timestamp_string = Time.now.strftime("%Y%m%d%H%M%S") | |
filename = "#{application}.dump.#{timestamp_string}.sql.bz2" | |
file = "/tmp/#{filename}" |
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 File.dirname(__FILE__) + "/spec_helper" | |
include ZodiacHelper | |
describe "Zodiac" do | |
before :each do | |
@date = Time.utc(2000, "jun", 12) | |
end | |
it "returns the zodiac sign for a given Time" do |
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
module ZodiacHelper | |
def zodiac_sign_for(date) | |
if date.respond_to?(:strftime) | |
birth = date.strftime("%m%d").to_i # month/day as an integer | |
else | |
birth = date | |
end | |
case birth | |
when 11..120 then zodiac = "Capricorn" |
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
module ZodiacHelper | |
# Returns the zodiac sign for a given date that can be specified either as | |
# a Time object or as a text string with month/day: | |
# zodiac_sign_for(Time.utc(2000, "jun", 12)) | |
# # => "Gemini" | |
# | |
# zodiac_sign_for(1118) # November 18 | |
# # => "Scorpio" | |
# | |
# zodiac_sign_for(612) # June 12 |
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
federico@korobushka ~ | |
$ ir | |
bash: ir: command not found | |
federico@korobushka ~ | |
$ irb | |
irb(main):001:0> | |
SyntaxError: compile error | |
(irb):1: syntax error, unexpected tSTRING_BEG, expecting kDO or '{' or '(' | |
"".nil? ? puts "es nulo" : puts p.category.text | |
^ |