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
Todas as funcionalidades utilizadas em dois ou mais models devem ser transformadas em uma library ou module (biblioteca ou módulo). | |
Talvez a grande vantagem de Ruby sobre linguagens similares a Java são mixins(modules). Não ignore isso - aproveite isso ao máximo. | |
No OO estilo-Java, pra conseguir funcionalidade compartilhada entre classes, você geralmente tem que fazer subclasses. Este não é o caso. Em ruby você pode embutir (com mixins) funcionalidades de vários modules diferentes em qualquer classe ou objeto - até em tempo de execução. Entenda modules bem, e utilize-os para compartilhar código duplicado entre models (e controllers)! | |
Toda a lógica duplicada entre duas ou mais aplicações deve ser transformada em um plugin gemificado. | |
Agora que plugins podem ser gemificados, não existe mais razão para não fazer plugins. Eles são fáceis de fazer, e agora muito fáceis de *reusar e gerenciar nos seus diversos deployments*. | |
Ao contrário de outros frameworks, os plugins do Ruby on Rails são extremamente |
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
require 'benchmark' | |
def quicksort(entry, method) | |
return entry if entry.size <= 1 | |
pivot = identify_pivot(entry, method) | |
left, right = entry.partition {|e| e < pivot} | |
quicksort(left, method) + [pivot] + quicksort(right, method) | |
end | |
def identify_pivot(entry, method) |
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
http://wordpress.org/extend/themes/clockworksimple | |
http://wordpress.org/extend/themes/clockworkmint | |
http://wordpress.org/extend/themes/wheat-lite | |
http://wordpress.org/extend/themes/emptiness | |
http://wordpress.org/extend/themes/thematic | |
http://wordpress.org/extend/themes/defusion | |
http://wordpress.org/extend/themes/greymonger-theme | |
http://wordpress.org/extend/themes/elegance | |
http://wordpress.org/extend/themes/greyville | |
http://wordpress.org/extend/themes/8some |
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
# Copyright (c) 2008 Thiago Freire | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
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
require 'test_helper' | |
class ProductTest < ActiveSupport::TestCase | |
context "given an existing product" do | |
fixtures :all | |
should_have_db_columns :id, :name, :description, :price, :quantity | |
should_have_db_column :name, :type => "string", :null => false | |
should_have_db_column :price, :type => "decimal", :null => false, :scale => 2 | |
should_have_db_column :quantity, :type => "integer", :default => 0, :null => false |
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
development: | |
host: 192.168.0.1 | |
port: 389 | |
base: dc=gaiz,dc=com,dc=br | |
bind_dn: cn=admin,dc=gaiz,dc=com,dc=br | |
password: gaiz | |
test: | |
host: 127.0.0.1 | |
port: 389 |
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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
# SUPER DARING APP TEMPLATE 1.0 | |
# Originally By Peter Cooper | |
# Modified by Jason Seifer | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/Source/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" |
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
server "shawshank", :app | |
namespace :list do | |
task :labs do | |
run "ls -l /var/www/labs.freireag.com/public" | |
end | |
task :topchart do | |
run "ls -l /var/www/labs.freireag.com/public/topchart_app" | |
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
#!/usr/bin/env ruby -w | |
# Create a default gitignore file in the passed directory | |
# | |
# AUTHOR: Daniel Lopes | |
# September 10, 2009 | |
# | |
# USAGE: | |
# git-ignore . "aditional_file1 aditional_file2" | |
require 'pathname' |
OlderNewer