This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23, você tá sem bandolera? | |
Numa altua dessa do campeonato, o Sr. té sem bandolera, seu 23. | |
Quer dizer o companheiro seu cai no chão, baleado, Sr. vai pegar esse fuzil e vai fazer o que? | |
Vai jogar no chão? | |
- Não Sr. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ao invés de fazer isso: | |
def do_action(hashed_code = vendor.hashed_code) | |
get :edit, invite_id: hashed_code | |
end | |
# Vamos fazer isso: | |
def do_action(params = {}) | |
get :edit, {invite_id: vendor.hashed_code}.merge(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
namespace :integration do | |
namespace :heroku do | |
task :add_remote do | |
sh "git remote add staging [email protected]:nomedoprojeto-staging.git" if `git remote |grep staging`.strip.blank? | |
sh "git remote add production [email protected]:com:nomedoprojeto-production.git" if `git remote |grep production`.strip.blank? | |
end | |
task :check do | |
var = `heroku config -s --app nomedoprojeto-staging|grep INTEGRATING_BY` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
namespace :heroku do | |
namespace :deploy do | |
PRODUCTION_APP = 'nomedoprojeto-production' | |
STAGING_APP = 'nomedoprojeto-staging' | |
def run(*cmd) | |
system(*cmd) | |
raise "Command #{cmd.inspect} failed!" unless $?.success? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# account.rb | |
class Account < ActiveRecord::Base | |
has_many :users | |
has_many :services | |
end | |
# user.rb | |
class User < ActiveRecord::Base | |
belongs_to :account | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this file on config/initializer | |
# This will create an empty whitelist of attributes available for mass assignment for | |
# all models in your app. As such, your models will need to explicitly whitelist | |
# accessible parameters by using an attr_accessible declaration. This technique is best | |
# applied at the start of a new project. However, for an existing project with a thorough | |
# set of functional tests, it should be straightforward and relatively quick to insert this | |
# initializer, run your tests, and expose each attribute (via attr_accessible) as dictated | |
# by your failing tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p290 :001 > 0/0 | |
ZeroDivisionError: divided by 0 | |
from (irb):1:in `/' | |
from (irb):1 | |
from /Users/rafael/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>' | |
ruby-1.9.2-p290 :002 > 1.0/0 | |
=> Infinity | |
ruby-1.9.2-p290 :003 > 0.0/0 | |
=> NaN | |
ruby-1.9.2-p290 :004 > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
# Rafael Lima (http://rafael.adm.br) | |
# License: http://creativecommons.org/licenses/by/2.5/ | |
# | |
# ATTENTION: This is a initial work, use it at your own risk! | |
# | |
# Usage: | |
# $ APP_NAME=myappname rake heroku:migrate_from_bamboo_to_cedar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# conteúdo do CSV | |
SF,Técnico Legislativo,Direito Constitucional,Constitucionalismo | |
SF,Técnico Legislativo,Direito Constitucional,Teoria do Estado | |
# método para refatorar | |
def self.concourses_from_file(file_path) | |
return @concourses unless @concourses.nil? | |
@concourses = {} | |
CSV.foreach(file_path) do |row| | |
@concourses[row[0].upcase] ||= {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 24 | 24 | 3 | 4 | 1 | 4 | | |
| Helpers | 2 | 2 | 0 | 0 | 0 | 0 | | |
| Models | 114 | 100 | 6 | 12 | 2 | 6 | | |
| Libraries | 41 | 37 | 0 | 1 | 0 | 35 | | |
| Model specs | 258 | 242 | 0 | 0 | 0 | 0 | | |
| Controller specs | 64 | 57 | 0 | 2 | 0 | 26 | | |
| Routing specs | 28 | 26 | 0 | 0 | 0 | 0 | |