Skip to content

Instantly share code, notes, and snippets.

View rafaelp's full-sized avatar

Rafael Lima rafaelp

View GitHub Profile
@rafaelp
rafaelp / startupdev_heroku_bootstrapp.sh
Created November 15, 2011 13:57
Startup DEV - Heroku Bootstrapp
#!/bin/bash
heroku auth:login
heroku apps:create -s cedar $1
heroku sharing:add contato@mergulhao.info
heroku sharing:add ramonpage@gmail.com
heroku sharing:add rafael.lima@bielsystems.com.br
heroku addons:add shared-database:5mb
heroku addons:add loggly:mole
heroku addons:add pgbackups:auto-month
@rafaelp
rafaelp / acts_as_paranoid.rb
Created October 12, 2011 15:18
ActAsParanoid para Rails 3
module ActsAsParanoid
def acts_as_paranoid
default_scope where(:deleted_at => nil)
include InstanceMethods
end
module InstanceMethods
def destroy
@rafaelp
rafaelp / Gemfile.amigonaosecompra
Created October 11, 2011 19:18
Gemfile do Amigo não se Compra
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'rack', '1.3.3'
gem 'jquery-rails'
gem 'pg', '0.11.0'
gem 'silent-postgres', '0.0.8'
gem 'thin', '1.2.11'
gem 'devise', '1.4.7'
gem 'haml', '3.1.3'
@rafaelp
rafaelp / amigonaosecompra-stats-v1
Created October 11, 2011 17:42
Rake Stats do Amigo não se Compra
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 22 | 17 | 3 | 2 | 0 | 6 |
| Helpers | 3 | 2 | 0 | 0 | 0 | 0 |
| Models | 25 | 15 | 2 | 1 | 0 | 13 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Model specs | 48 | 40 | 0 | 0 | 0 | 0 |
| Controller specs | 49 | 37 | 0 | 0 | 0 | 0 |
| Mailer specs | 51 | 40 | 0 | 1 | 0 | 38 |
@rafaelp
rafaelp / freelancerfree-stats-v1
Created October 4, 2011 19:29
Rake Stats do Freelancer Free
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 100 | 85 | 4 | 10 | 2 | 6 |
| Helpers | 4 | 4 | 0 | 0 | 0 | 0 |
| Models | 78 | 58 | 4 | 8 | 2 | 5 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Model specs | 129 | 113 | 0 | 0 | 0 | 0 |
| Controller specs | 121 | 108 | 0 | 1 | 0 | 106 |
| Helper specs | 15 | 4 | 0 | 0 | 0 | 0 |
@rafaelp
rafaelp / gist:1202297
Created September 8, 2011 00:40
Rake Stats do BioSafeTI
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 112 | 89 | 9 | 12 | 1 | 5 |
| Helpers | 28 | 23 | 0 | 4 | 0 | 3 |
| Models | 189 | 153 | 8 | 25 | 3 | 4 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Model specs | 438 | 380 | 0 | 0 | 0 | 0 |
| Controller specs | 857 | 755 | 0 | 10 | 0 | 73 |
| Helper specs | 68 | 62 | 0 | 0 | 0 | 0 |
def index
if !params[:year].blank? and !params[:month].blank? and !params[:day].blank?
@date = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}")
else
@date = Date.today
end
end
@rafaelp
rafaelp / contacal-stats1.txt
Created August 23, 2011 22:46
Rake stats do ContaCal
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 37 | 30 | 4 | 4 | 1 | 5 |
| Helpers | 3 | 2 | 0 | 0 | 0 | 0 |
| Models | 38 | 31 | 3 | 2 | 0 | 13 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Model specs | 169 | 158 | 0 | 0 | 0 | 0 |
| Controller specs | 105 | 90 | 0 | 1 | 0 | 88 |
| Helper specs | 0 | 0 | 0 | 0 | 0 | 0 |
@rafaelp
rafaelp / gist:1125287
Created August 4, 2011 14:31
Bug no brdinheiro?
ree-1.8.7-2010.02 :002 > bb.paid_amount
=> #<Dinheiro:0x105e72e48 @quantia=10000>
ree-1.8.7-2010.02 :003 > bb.paid_amount.nil?
=> false
ree-1.8.7-2010.02 :004 > bb.paid_amount = nil
=> nil
ree-1.8.7-2010.02 :005 > bb.paid_amount.nil?
=> false
ree-1.8.7-2010.02 :014 > bb.paid_amount
=> #<Dinheiro:0x105e72e48 @quantia=10000>
@rafaelp
rafaelp / factory_girl_reset_sequences.rb
Created August 4, 2011 05:24
Reset Sequences no Factory Girl 2.02
module FactoryGirl
class Sequence
def reset
@value = 1
end
end
module Syntax
module Vintage
module Factory
def self.reset_sequences