Skip to content

Instantly share code, notes, and snippets.

View mateuslinhares's full-sized avatar

Mateus Linhares mateuslinhares

View GitHub Profile
set :aws_servers, `/usr/bin/curl -s 'http://url.aws/show'`.split(', ')
set :rails_env, "production"
set :user, "deploy"
set :runner, "deploy"
set :branch, "master"
aws_servers.each do |aws_server|
role :app, aws_server
role :web, aws_server
end
@mateuslinhares
mateuslinhares / ES_Stemming.rb
Created March 26, 2012 18:04 — forked from hohyon-ryu/ES_Stemming.rb
Stemming for ElasticSearch (Portuguese example)
# Script to test stemming for ElasticSearch. Working now!!
# Reference: http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-finding-my-term
require 'rubygems'
require 'net/http'
require 'yaml'
require 'json'
# kill the index
delete = Net::HTTP::Delete.new("/willindex")
@mateuslinhares
mateuslinhares / ratings_spec.rb
Created August 12, 2011 16:31
example using capybara and capybara-webkit
require 'spec_helper'
feature "Rating" do
let(:current_user){ Factory(:user) }
let(:post){ Factory(:post) }
let!(:comment){ Factory(:comment, :commentable => post) }
background do
sign_in_as(current_user)
end
## Controller
def rate
@book = Book.find(params[:id])
@book.rate params[:rating].to_i
render :update do |page|
page.replace_html("rating", {:partial => "rate", :locals => {:rateable => @book}})
page.show "success_rating"
end
end