Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Caton lucascaton

View GitHub Profile
View gist:190916
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
View Rails3.rb
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 :)
View Class#attr_accessor alternative
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
View application.js
$(function(){
setExternalLinks();
configureModalDialog();
flashMessages();
configInputs();
});
// by Catón
View gist:908470
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
View gist:916906
$ 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.
View gist:916947
$ 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.
View gist:929137
[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 Apr 21, 2011 — forked from szimek/capybara_select_dates_and_times.rb
Cucumber steps for selecting time and date (using Capybara)
View capybara_select_dates_and_times.rb
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