Skip to content

Instantly share code, notes, and snippets.

View cassiomarques's full-sized avatar
💭
I have no idea what I'm doing

Cássio Marques cassiomarques

💭
I have no idea what I'm doing
View GitHub Profile
vIDEGAMES À VENDA!!!
====================
- Nintendo Wii (R$ 450,00)
===========================
- 2 constroles
- 1 nunchuk
- Na caixa
- Destravado (via software)
- Jogo Metroid Prime Corruption (original)
LIVROS À VENDA
===============
- [vendido] Design Patterns in Ruby - Russ Olsen (Addison Wesley, capa dura) R$ 50,00
- [vendido] Refactoring Ruby Edition - Jay Fields, Shade Harvie & Martin Fowler (Addison Wesley, capa dura) R$ 50,00
- [vendido] The Well-Grounded Rubyist - David A. Black (Manning) R$ 35,00
- The Rails Way 1st Edition (cobre até o Rails 2) - Obie Fernandez (Addison Wesley) R$ 30,00
- Programming Ruby (PickAxe, 2a edição, cobre até Ruby 1.8.7) - Dave Thomas (Pragmatic Programmers) R$ 30,00
- Ruby Cookbook - Lucas Carlson & Leonard Richardsob ( O'Reilly) R$ 25,00
- Agile Web Development with Rails (2a edição, cobre Rails 1.2.6) - Dave Thomas & DHH (Pragmatic Programmers) R$ 15,00
"in ~/.vim/macros/rails.vim
Rnavcommand service app/services -suffix=.rb
Rnavcommand cell app/cells -suffix=.rb
Rnavcommand presenter app/presenters -suffix=.rb
# Using Rspec 2.5.0 + Spork
#
# Before the hack:
# 2131/2131: 100% |==========================================| Time: 00:02:26
#
# After the hack:
# 2131/2131: 100% |==========================================| Time: 00:02:09
# spec/spec_helper.rb (simplified...)
# Adapted from http://37signals.com/svn/posts/2742-the-road-to-faster-tests
class CreatePersons < ActiveRecord::Migration
def self.up
create_table do |t|
t.integer :relationship_status
t.string :name
end
end
end
class RelationshipStatus < EnumerateIt::Base
@cassiomarques
cassiomarques / gist:769777
Created January 7, 2011 17:26
Model do manage PostgreSQL database constraints
# == Schema Information
#
# Table name: information_schema.table_constraints
#
# constraint_catalog :
# constraint_schema :
# constraint_name :
# table_catalog :
# table_schema :
# table_name :
class ContactType < EnumerateIt::Base
associate_values(
:email => 1,
:sms => 2,
:phone => 3,
:smoke_signal => 4
)
end
person = Person.new
@cassiomarques
cassiomarques / gist:674824
Created November 12, 2010 22:37
New features for EnumerateIt
# Feature1: Change enumeration value based on bang methods (available only
# when passing true to the :create_helpers option)
class RelationshipStatus < EnumerateIt::Base
associate_values(
:single => 1,
:married => 2,
:widow => 3
)
end
@cassiomarques
cassiomarques / gist:663500
Created November 5, 2010 01:14
How to read constraints direct from postgresql databases
# == Schema Information
#
# Table name: information_schema.table_constraints
#
# constraint_catalog :
# constraint_schema :
# constraint_name :
# table_catalog :
# table_schema :
# table_name :
@cassiomarques
cassiomarques / gist:658634
Created November 1, 2010 18:13
Como fazer o webdriver aceitar os diálogos de confirmação JavaScript do browser (testei apenas no Chrome)
# MacGyver mode ON
Quando /^sigo "([^"]*)" aceitando a confirmação$/ do |link|
page.execute_script("window.confirm = function() { return true; }")
click_link link
end