Skip to content

Instantly share code, notes, and snippets.

View rinaldifonseca's full-sized avatar

Rinaldi Fonseca rinaldifonseca

View GitHub Profile
@rinaldifonseca
rinaldifonseca / debvise.rb
Created February 18, 2011 19:03
initializer of devise
def http_authentication
super or ''
end
def authenticate!
super
end
end
Warden::Strategies.add(:http_auth_non_html, HttpAuthenticatableNonHtml)
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# Create a file `spec/acceptance/support/warden.rb' with the following
# contents:
Spec::Runner.configure do |config|
config.include Warden::Test::Helpers, :type => :acceptance
config.after(:each, :type => :acceptance) { Warden.test_reset! }
end
# Or, if you're using RSpec 2 / Rails 3, the contents should be the following
# instead:
app_name = ARGV[0].humanize
# Remove unwanted files
remove_file "public/index.html"
remove_file "public/favicon.ico"
remove_file "public/images/rails.png"
remove_file "public/robots.txt"
# Add gems to Gemfile
append_to_file 'Gemfile', %Q{
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
def transfere(to, valor)
to.link("transfer").post(:valor => valor)
end
def processa_pagamento(pessoa, aulas, consultorias, opensource, bank)
parcelas = []
total = 0
aulas.each do |a|
aula.verify do |v|
heffalump:~ james$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1]
heffalump:~ james$ php -v
PHP 5.3.4 (cli) (built: Jan 17 2011 21:54:20)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
heffalump:~ james$ cat foo.rb
msg = "Hello world"
module Test
module Unit
TestCase = RSpec::Core::ExampleGroup
end
end
class Test::Unit::TestCase
def self.inherited(host)
host.set_it_up host.name.gsub(/(Spec|Test)/,'')
def host.method_added(name)
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
class Tupla <T> {
private final T esquerda;
private final T direita;
public Tupla(T esquerda, T direita) {
@rinaldifonseca
rinaldifonseca / bassie.png
Created April 29, 2011 02:00 — forked from jeffkreeftmeijer/bassie.png
Colored image blob detection
bassie.png
@rinaldifonseca
rinaldifonseca / config.ru
Created May 8, 2011 02:08 — forked from fnando/rubygems_proxy.rb
Rack app for caching RubyGems files. Very useful in our build server that sometimes fails due to our network or rubygems.org timeout.
require "./rubygems_proxy"
run RubygemsProxy