Skip to content

Instantly share code, notes, and snippets.

# 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
# 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
# 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
@febuiles
febuiles / foo
Created November 10, 2008 21:43
$ ./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"
#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"))
# 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}"
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
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"
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
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
^