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
# app/business/concert/update.rb | |
# Concert::RescheduleEmail.sent(concert, new_time) | |
class Concert::RescheduleEmail | |
def self.sent(concert, new_time) | |
new(concert, new_time).sent | |
end | |
def initialize(concert, new_time) | |
@concert, @starts_at = concert, new_time.to_time |
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
def update | |
if @concert.update(params[:concert]) | |
@concert.confirm! | |
redirect_to user_concert_path(current_user, @concert), notice: t('flash.concerts.update_success') | |
else | |
@top_tippers = ConcertPayment.top_tippers(@concert).limit(5) # isso daqui dá pra melhorar, chamar @concert.top_tippers é mais legível | |
@concert_payments = @concert.concert_payments # se não for usar na view, nao precisa ser variavel de instancia esse @concert_payments | |
@amount = @concert_payments.amount # => faz scope disso map(&:amount).sum, sem usar os métodos do ruby. Faça um sql. | |
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
def embed(youtube_url) | |
content_tag(:iframe, nil, src: youtube_url) | |
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
source /usr/local/git/contrib/completion/git-completion.bash | |
complete -C "/usr/bin/gemedit --complete" gemedit | |
export WORKON_HOME=~/.env | |
export JAVA7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home | |
export JAVA6_HOME=/Library/Java/Home | |
export JAVA_HOME=$JAVA6_HOME | |
export PATH=$JAVA_HOME/bin:$PATH | |
export SBT_OPTS="-XX:MaxPermSize=256M" |
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
class UserAccount | |
include LinkWithFacebook | |
include LinkWithTwitter | |
include SignUpWithFacebook | |
include SignUpWithTwitter | |
def initialize(params) | |
@user_params = params[:user] | |
@social_params = params[:social] | |
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
By Klaus Wuestefeld | |
1) Torne-se excelente. | |
Seja realmente bom em alguma coisa. Não fique só choramingando ou | |
querendo progredir às custas dos outros. Não pense q pq vc sentou 4 | |
anos numa faculdade ouvindo um professor falar sobre software q vc | |
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo | |
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo | |
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da |
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
charset_table: "0..9, a..z, _, A..Z->a..z, U+2E->., U+00C0->a, U+00C1->a,U+00C2->a, U+00C3->a, U+00C4->a, U+00C5->a, U+00C7->c, U+00C8->e,U+00C9->e, U+00CA->e, U+00CB->e, U+00CC->i, U+00CD->i, U+00CE->i,U+00CF->i, U+00D1->n, U+00D2->o, U+00D3->o, U+00D4->o, U+00D5->o,U+00D6->o, U+00D9->u, U+00DA->u, U+00DB->u, U+00DC->u, U+00DD->y,U+00E0->a, U+00E1->a, U+00E2->a, U+00E3->a, U+00E4->a, U+00E5->a,U+00E7->c, U+00E8->e, U+00E9->e, U+00EA->e, U+00EB->e, U+00EC->i,U+00ED->i, U+00EE->i, U+00EF->i, U+00F1->n, U+00F2->o, U+00F3->o,U+00F4->o, U+00F5->o, U+00F6->o, U+00F9->u, U+00FA->u, U+00FB->u,U+00FC->u, U+00FD->y, U+00FF->y, U+0100->a, U+0101->a, U+0102->a,U+0103->a, U+0104->a, U+0105->a, U+0106->c, U+0107->c, U+0108->c,U+0109->c, U+010A->c, U+010B->c, U+010C->c, U+010D->c, U+010E->d,U+010F->d, U+0112->e, U+0113->e, U+0114->e, U+0115->e, U+0116->e,U+0117->e, U+0118->e, U+0119->e, U+011A->e, U+011B->e, U+011C->g,U+011D->g, U+011E->g, U+011F->g, U+0120->g, U+0121->g, U+0122->g,U+0123->g, U+0124->h, U+0125->h, U+0128 |
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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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
Ext.XTemplate.from = function(el){ | |
el = Ext.getDom(el); | |
var string = el.value || el.innerHTML; | |
string = string.replace(/%7B/g, "{").replace(/%7D/g, "}").replace(/%21/g, "!"); | |
return new Ext.XTemplate(string); | |
}; | |
if(!Array.prototype.add) { | |
Array.prototype.add = function(item) { | |
this[this.length] = item; |
OlderNewer