Skip to content

Instantly share code, notes, and snippets.

View vinibaggio's full-sized avatar

Vinicius Baggio Fuentes vinibaggio

View GitHub Profile
# spec/acceptance/acceptance_helper.rb
RSpec.configure do |config|
config.before(:each) do
Capybara.current_driver = :selenium if example.metadata[:js]
end
config.after(:each) do
Capybara.use_default_driver if example.metadata[:js]
end
end
module Spec
module MyHelper
def account
accounts(:blank_account)
end
def accounts(fixture)
@fixtures_cache ||= Fixtures.create_fixtures('spec/fixtures', 'accounts')
@fixture_hash ||= Hash[@fixtures_cache]
charset_table: "0..9, a..z, _, A..Z->a..z, U+2E->., U+00C0->a, U+00C1->a,U+00C2->a, U+00C3->a, U+00C4->a, U+00C5->a, U+00C7->c, U+00C8->e,U+00C9->e, U+00CA->e, U+00CB->e, U+00CC->i, U+00CD->i, U+00CE->i,U+00CF->i, U+00D1->n, U+00D2->o, U+00D3->o, U+00D4->o, U+00D5->o,U+00D6->o, U+00D9->u, U+00DA->u, U+00DB->u, U+00DC->u, U+00DD->y,U+00E0->a, U+00E1->a, U+00E2->a, U+00E3->a, U+00E4->a, U+00E5->a,U+00E7->c, U+00E8->e, U+00E9->e, U+00EA->e, U+00EB->e, U+00EC->i,U+00ED->i, U+00EE->i, U+00EF->i, U+00F1->n, U+00F2->o, U+00F3->o,U+00F4->o, U+00F5->o, U+00F6->o, U+00F9->u, U+00FA->u, U+00FB->u,U+00FC->u, U+00FD->y, U+00FF->y, U+0100->a, U+0101->a, U+0102->a,U+0103->a, U+0104->a, U+0105->a, U+0106->c, U+0107->c, U+0108->c,U+0109->c, U+010A->c, U+010B->c, U+010C->c, U+010D->c, U+010E->d,U+010F->d, U+0112->e, U+0113->e, U+0114->e, U+0115->e, U+0116->e,U+0117->e, U+0118->e, U+0119->e, U+011A->e, U+011B->e, U+011C->g,U+011D->g, U+011E->g, U+011F->g, U+0120->g, U+0121->g, U+0122->g,U+0123->g, U+0124->h, U+0125->h, U+0128
source $HOME/.vimrc
colorscheme vividchalk
set gfn=Menlo\ Regular:h12
set guioptions=egmrt
set showtabline=2
set transparency=5
set lines=50
require 'rubygems'
gem "rack", "1.0.1"
gem "sinatra", "1.0"
gem "hpricot", "0.8.2"
gem "amatch", "0.2.5"
gem "sinatra-content-for"
gem "json"
# NOTE: Inline templates defined in the source file that requires sinatra are automatically
# loaded.
# Call `enable :inline_templates` explicitly if you have inline templates in other source
# files.
require 'rubygems'
require 'sinatra'
get '/' do
module PagseguroHelper
def pagseguro_form(order)
content_tag(:form, :id => "pagseguro", :target => 'pagseguro', :method => 'post', :action => 'https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx') do
result = ""
result << hidden_field_tag(:email_cobranca, 'seu@email.com')
result << hidden_field_tag(:tipo, 'CP') # Chumbado
result << hidden_field_tag(:moeda, 'BRL') # Chumbado
result << hidden_field_tag(:ref_transacao, order.id)
result << hidden_field_tag(:encoding, 'utf-8')
result << hidden_field_tag(:tipo_frete, 'SD') # Sedex - pro pagseguro calcular o frete automagicamente
require 'capistrano/ext/multistage'
set :application, "minha_app"
set :repository, "meu_repositorio"
set :scm, :git
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
# Codigo que me faz chorar
Proc.new { eval(my_string) }.call
# Métodos que me fazem chorar...
def self.recently_accessed
find :all, :conditions => { :id => [186,268,234,107,176] }
end