Skip to content

Instantly share code, notes, and snippets.

View lucascaton's full-sized avatar

Lucas Caton lucascaton

View GitHub Profile
class CreateStuffs < ActiveRecord::Migration
def self.up
create_table :stuffs, :primary_key => :cod do |t|
t.integer :cod
t.integer :stuff_type_id
t.timestamps
end
end
class Posts < Application
provides :xml, :json
def index
@posts = Post.all
display @posts
end
end
#Este controller responde solicitações em html, xml, e json :)
class Class
def sets_gets(*args)
args.each do |arg|
define_method(arg) { eval "@#{arg}" }
define_method("#{arg}=".to_sym) { |param| eval "@#{arg}=param" }
end
end
end
class Person
Testing Gist-vim plugin...
$(function(){
setExternalLinks();
configureModalDialog();
flashMessages();
configInputs();
});
// by Catón
public/items/0000/1/filename.jpg
public/items/0000/1/filename_thumb.jpg
public/system/items/1/original/filename.jpg
public/system/items/1/thumb/filename.jpg
$ rvm install jruby-head
jruby-head - #fetching
error: pathspec 'ruby_1_head_head' did not match any file(s) known to git.
fatal: Couldn't find remote ref ruby_1_head_head
There has been an error while checking out branch ruby_1_head_head.
Halting the installation.
There has been an error while trying to fetch the source.
Halting the installation.
$ rvm install jruby-head
jruby-head - #fetching
Cloning from git://github.com/jruby/jruby.git, this may take a while depending on your connection...
Cloning into /Users/lucascaton/.rvm/repos/jruby-head...
remote: Counting objects: 31424, done.
remote: Compressing objects: 100% (14989/14989), done.
remote: Total 31424 (delta 21024), reused 24309 (delta 14939)
Receiving objects: 100% (31424/31424), 44.22 MiB | 577 KiB/s, done.
Resolving deltas: 100% (21024/21024), done.
[ree-1.8.7-2011.03]~/projects/code/ruby/pessoais/golks(working*)$ rspec spec/integration/users/users_spec.rb -l 20
`include Capybara` is deprecated please use `include Capybara::DSL` instead.
`include Capybara` is deprecated please use `include Capybara::DSL` instead.
`include Capybara` is deprecated please use `include Capybara::DSL` instead.
Run filtered using {:line_number=>20}
Users management
Trying sign in with a not confirmed user account (FAILED - 1)
Failures:
@lucascaton
lucascaton / capybara_select_dates_and_times.rb
Created April 21, 2011 16:13 — forked from szimek/capybara_select_dates_and_times.rb
Cucumber steps for selecting time and date (using Capybara)
require "xpath" # XPath is a separate gem now
module Cucumber
module Rails
module CapybaraSelectDatesAndTimes
def select_date(field, options = {})
date = Date.parse(options[:with])
selector = %Q{.//fieldset[contains(./legend, "#{field}")]}
within(:xpath, selector) do
find(:xpath, '//select[contains(@id, "_1i")]').find(:xpath, ::XPath::HTML.option(date.year.to_s)).select_option