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
function reverseMenuItem() { | |
$('li.main').each(function(i) { | |
qnt = $('li.main').length; | |
if (i == (qnt-1) || i == (qnt-2)) { | |
li_width = $('li.main:eq('+i+')').width(); | |
ul_width = $('li.main:eq('+i+') ul').width() + 24 - li_width; | |
$('li.main:eq('+i+') ul').css({ | |
marginLeft: -ul_width | |
}); |
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
<% semantic_form_for @post do |form| %> | |
<% form.inputs :name => "Basic", :id => "basic" do %> | |
<%= form.input :title %> | |
<%= form.input :cpf, :mask => '999.999.999-99' %> | |
<%= form.input :cep, :mask => '99.999-999' %> | |
<% end %> | |
<% form.buttons do %> | |
<%= form.commit_button %> | |
<% end %> | |
<% 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
# basico, to testando desta forma | |
# action | |
def new | |
@driver = Driver.new | |
end | |
# teste com remarkable | |
describe :get => :new do | |
expects :new, :on => Driver, :returns => driver_proc |
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
# 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 |
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
# 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 |
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
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" |
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
" 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 |
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
describe 'Person' | |
before_each | |
person = new Person('Lopes') | |
end | |
describe '.getName()' | |
it 'deve retornar o nome' | |
person.getName().should.be 'Lopes' | |
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
# Returns all posts. | |
# http://www.delicious.com/help/api#posts_all | |
curl https://username:password@api.del.icio.us/v1/posts/all > bookmarks.xml |
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
# | |
# 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 |