Skip to content

Instantly share code, notes, and snippets.

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
@jtadeulopes
jtadeulopes / gist:887684
Created March 25, 2011 21:36
exemplos...
385002 = 38500-200
38500201 = 38500-201
2950 = 00295-000
22923 = 02292-300
125 = 00012-500
@jtadeulopes
jtadeulopes / gist:796052
Created January 26, 2011 01:34
rvm prompt
# colocar dentro do ~/.bash_profile
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# rvm
@jtadeulopes
jtadeulopes / gist:753877
Created December 24, 2010 03:44
dls for backup!
#
# Backup of mysql, files, whatever...
#
# example 1
backup.start do
new :mysql => {:host => '0.0.0.0', :user => 'root', :password => 'mypass'}
new :mysql => {:host => '0.0.0.0', :user => 'root', :password => 'mypass'}
new :archive => {:host => '0.0.0.0', :user => 'root', :password => 'mypass', :remote_file => ''}
end
@jtadeulopes
jtadeulopes / gist:744960
Created December 17, 2010 13:54
export delicious
# Returns all posts.
# http://www.delicious.com/help/api#posts_all
curl https://username:password@api.del.icio.us/v1/posts/all > bookmarks.xml
describe 'Person'
before_each
person = new Person('Lopes')
end
describe '.getName()'
it 'deve retornar o nome'
person.getName().should.be 'Lopes'
end
" Trocar de abas dentro do gvim usando Alt+1, Alt+2...
" Editar o arquivo ~/.vimrc e inserir os dados abaixo
"tabs
map <D-1> 1gt
map <D-2> 2gt
map <D-3> 3gt
map <D-4> 4gt
map <D-5> 5gt
map <D-6> 6gt
@jtadeulopes
jtadeulopes / gist:449959
Created June 23, 2010 14:07
.bash_profile
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="4;33"
export CLICOLOR="auto"
source ~/.git-completion.sh
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
export SCALA_HOME="/usr/local/scala-2.7.7.final"
export JAVA="$JAVA_HOME/bin/java"
export SCALA="$SCALA_HOME/bin/scala"
export PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:/usr/local/mysql/bin:$PATH"
# model Curso
# app/model/course.rb
class Course < ActiveRecord::Base
has_many :payments, :order => "id"
accepts_nested_attributes_for :payments, :allow_destroy => true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
end
# remove arquivos desnecessários
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm README"
run "rm doc/README_FOR_APP"
# gera um controller home e action index
generate :controller, "home", "index"
# define a rota root