This file contains hidden or 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
# Using Rspec 2.5.0 + Spork | |
# | |
# Before the hack: | |
# 2131/2131: 100% |==========================================| Time: 00:02:26 | |
# | |
# After the hack: | |
# 2131/2131: 100% |==========================================| Time: 00:02:09 | |
# spec/spec_helper.rb (simplified...) | |
# Adapted from http://37signals.com/svn/posts/2742-the-road-to-faster-tests |
This file contains hidden or 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
"in ~/.vim/macros/rails.vim | |
Rnavcommand service app/services -suffix=.rb | |
Rnavcommand cell app/cells -suffix=.rb | |
Rnavcommand presenter app/presenters -suffix=.rb |
This file contains hidden or 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
LIVROS À VENDA | |
=============== | |
- [vendido] Design Patterns in Ruby - Russ Olsen (Addison Wesley, capa dura) R$ 50,00 | |
- [vendido] Refactoring Ruby Edition - Jay Fields, Shade Harvie & Martin Fowler (Addison Wesley, capa dura) R$ 50,00 | |
- [vendido] The Well-Grounded Rubyist - David A. Black (Manning) R$ 35,00 | |
- The Rails Way 1st Edition (cobre até o Rails 2) - Obie Fernandez (Addison Wesley) R$ 30,00 | |
- Programming Ruby (PickAxe, 2a edição, cobre até Ruby 1.8.7) - Dave Thomas (Pragmatic Programmers) R$ 30,00 | |
- Ruby Cookbook - Lucas Carlson & Leonard Richardsob ( O'Reilly) R$ 25,00 | |
- Agile Web Development with Rails (2a edição, cobre Rails 1.2.6) - Dave Thomas & DHH (Pragmatic Programmers) R$ 15,00 |
This file contains hidden or 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
vIDEGAMES À VENDA!!! | |
==================== | |
- Nintendo Wii (R$ 450,00) | |
=========================== | |
- 2 constroles | |
- 1 nunchuk | |
- Na caixa | |
- Destravado (via software) | |
- Jogo Metroid Prime Corruption (original) |
This file contains hidden or 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
value1 = 10; | |
var value2 = 0; | |
if(value2 == '') { | |
console.log("Não deveria ter sido executado!"); | |
} | |
var funA = function() { | |
value1 = value1 * 2; | |
} |
This file contains hidden or 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
var n = 3; | |
console.log(n.toFixed(5)); // 3.00000 | |
//ou | |
console.log(Number(1.23).toFixed(5)); // 1.23000 |
This file contains hidden or 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 A | |
def self.create_sub_class(name) | |
c= Class.new(self) | |
const_set name, c | |
end | |
end | |
A.create_sub_class "B" | |
A::B # ok! |
This file contains hidden or 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
# For example, in a migration | |
# | |
# create_check_with_enumeration :foobars, :column => :category, :with => FoobarsCategory | |
# | |
# will create a check constraint in the table "foobars", so the column "category" will only accept one | |
# of the values declared in the FoobarsCategory enumeration | |
# | |
module ActiveRecord | |
module ConnectionAdapters | |
class PostgreSQLAdapter < AbstractAdapter |
This file contains hidden or 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
/** | |
* Recebe um objeto e o nome de uma propridade. Verifica se a propriedade existe no objeto. | |
* Se não existir, para cada propriedade do objeto que também seja um objeto, chama a si | |
* mesma recursivamente verificando se a propriedade pode ser encontrada. | |
* Caso a propriedade não seja encontrada, retorna false. | |
*/ | |
function objectHasProperty(object, property) { | |
if (property in object) { | |
return true; | |
} else { |
This file contains hidden or 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
# This is part of my .pryrc. | |
# I put this at the section where I load Rails stuff, so I can use Pry instead of IRB | |
# for my Rails Console sessions | |
# Once this is loaded, just run the display_routes method from the console to see the same output that rake routes displays. | |
# I think it's better because I always leave a Rails console session running :) | |
require 'rails/application/route_inspector' |