Skip to content

Instantly share code, notes, and snippets.

View diegorv's full-sized avatar

Diego Rossini diegorv

View GitHub Profile
<html>
<head>
<title></title>
<META NAME="DESCRIPTION" CONTENT="">
<META NAME="KEYWORDS" CONTENT="">
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var total1 = 0;
set :application, "myapp"
set :keep_releases, 5
# git options
set :scm, "git"
set :repository, "git://github.com/georgeguimaraes/myapp.git"
set :branch, "master"
set :deploy_via, :remote_cache
# deploy credentials
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
# simple capistrano task for wordpress deploy
# just replace the content to fit your app path and names
# and run cap deploy:setup && cap deploy
# you can also run a cap wordpress:upload_config to copy the local config-sample.php to remote shared folder
# warning: this recipe don't create the database
# APP SETTINGS
set :application, "your_app_name"
set :domain_name , "yourdomain.com.br"
# Set up git repository
git :init
# remove all useless public files
run "rmdir tmp/{pids,sessions,sockets,cache}"
run "rm README"
run "rm log/*.log"
run "rm public/index.html"
run "rm public/javascripts/*"
run "rm public/favicon.ico"
def wait_for_ajax(timeout=5000)
js_condition = "selenium.browserbot.getCurrentWindow().jQuery.active == 0"
selenium.wait_for_condition(js_condition, timeout)
end
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'shoulda'
require 'webrat'
require 'factory_girl'
require 'test/factories/clearance'
require 'clearance/../../shoulda_macros/clearance'
require 'cucumber/rails/world'
Cucumber::Rails.use_transactional_fixtures
@diegorv
diegorv / allow.rb
Created July 14, 2011 02:09 — forked from fnando/allow.rb
RSpec matcher
RSpec::Matchers.define :allow do |*values|
match do |record|
values.collect {|value|
record.send("#{@attribute}=", value)
record.valid?
record.errors[@attribute].empty?
}.all?
end
chain :as do |attribute|
@diegorv
diegorv / have_named_scope.rb
Created August 24, 2011 19:37 — forked from bcardarella/have_named_scope.rb
Should Have Named Scope matcher for Rspec
module Shoulda # :nodoc:
module ActiveRecord # :nodoc:
# Examples:
# class Book < ActiveRecord::Base
# named_scope :test, :conditions => { :name => "test" }
# named_scope :by_name, lambda { |n| { :conditions => { :name => n} } }
# end
#
# RSpec: