Skip to content

Instantly share code, notes, and snippets.

Factory.define :click do |f|
f.association :faq
f.data Time.now
f.sequence(:codigo_cliente) { |n| n.to_s.rjust(6,"0") }
end
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 17, 2012 16:55
Configuração SimplePastie - Gist
git config --global github.user rodrigomb@gmail.com
git config --global github.token blablablabla
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 17, 2012 21:28
Configurar Heroku-Rails
gem install heroku
heroku create <NOME>
git remote add heroku git@heroku.com:<NOME>.git
git push heroku master
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 18, 2012 14:36
Install Tomcat on Ubuntu(Ex. para colocar no auto inicializar)
Installation
- Download e Descompatação
wget http://apache.mirror.pop-sc.rnp.br/apache/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz
tar xvzf apache-tomcat-6.0.35.tar.gz
- Movendo para o local "correto"
sudo mv apache-tomcat-6.0.35 /usr/local/tomcat
- Adicionar JAVA_HOME ao bashrc
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 30, 2012 11:47
RSpec test Models Validates
describe User do
before do
@user = User.new(name: "Example User", email: "user@example.com")
end
.
.
.
describe "when email is not present" do
before { @user.email = " " }
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 30, 2012 11:51
ReGex Validates
valid_email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: valid_email_regex }
font: http://ruby.railstutorial.org/chapters/modeling-users?version=3.2
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created January 31, 2012 18:44
Liberar memória Unix
echo 3 > /proc/sys/vm/drop_caches
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created February 1, 2012 18:42
Ordenar expectations - Rspec
Ordering
double.should_receive(:msg).ordered
double.should_receive(:other_msg).ordered
#This will fail if the messages are received out of order
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created February 1, 2012 23:18
Disabled and Hide the Spotlight Menu Icon in OS X Lion
# Disable Spotlight
The primary method is using launchctl, this will require the administrative password:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Another approach is to use the older indexing method of “sudo mdutil -a -i off” which turns off indexing only, but more on that in a minute.
# Reenable Spotlight
The guaranteed way to reenable Spotlight is to reload it into launchd using launchctl:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
@rodrigomaia
rodrigomaia / simplepastiefile.rb
Created February 2, 2012 15:58
Mudar ícone do Finder
Mudar icone do Finder:
System > Library > CoreServices > Dock ( Show Package Contents) > Contents > Resources> finder.png
e os da lixeira:
System > Library > CoreServices > Dock ( Show Package Contents) > Contents > Resources> trashempty.png e trashfull.png