Skip to content

Instantly share code, notes, and snippets.

View tinogomes's full-sized avatar
😀

Celestino Gomes tinogomes

😀
View GitHub Profile
@klauswuestefeld
klauswuestefeld / gist:2883085
Created June 6, 2012 16:29
1985 - 2030 Mainstream Software Development Overview
We couldn’t find that file to show.
@wycats
wycats / 0_app.rb
Created April 19, 2012 10:22
Example of using a simple future library for parallel HTTP requests
class TicketsController < ApplicationController
def show
tickets = params[:tickets].split(",")
ticket_data = tickets.map do |ticket|
parallel { Faraday.get("http://tickets.local/#{ticket}") }
end
render json: { tickets: ticket_data.map(&:result) }
end
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@rafaelp
rafaelp / attr_acessible_security.rb
Created March 5, 2012 03:59
How to protect against mass assignment attack
# Put this file on config/initializer
# This will create an empty whitelist of attributes available for mass assignment for
# all models in your app. As such, your models will need to explicitly whitelist
# accessible parameters by using an attr_accessible declaration. This technique is best
# applied at the start of a new project. However, for an existing project with a thorough
# set of functional tests, it should be straightforward and relatively quick to insert this
# initializer, run your tests, and expose each attribute (via attr_accessible) as dictated
# by your failing tests.
@klauswuestefeld
klauswuestefeld / gist:1595701
Created January 11, 2012 17:22
O Ciclo Vicioso Do Software Retranqueiro
We couldn’t find that file to show.
@soveran
soveran / elements.md
Created November 18, 2011 17:38
Excerpts from The Elements of Programming Style. The source of this compilation is unknown.

The Elements of Programming Style

The following rules of programming style are excerpted from the book "The Elements of Programming Style" by Kernighan and Plauger, published by McGraw Hill. Here is quote from the book: "To paraphrase an observation in The Elements of Style by Strunk and White, the rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules."

@caffo
caffo / GORILLA.BAS
Created October 31, 2011 03:24
QBasic Gorillas
' Q B a s i c G o r i l l a s
'
' Copyright (C) IBM Corporation 1991
'
' Your mission is to hit your opponent with the exploding banana
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:37
Use RSpec tags to add behavior around specs.
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
example.call
end
end
end
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:29
Focus on specific specs in RSpec
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
# and then use the :focus tag in your specs
it "does something awesome", :focus do
@klauswuestefeld
klauswuestefeld / gist:1186975
Created September 1, 2011 19:03
Martin Fowler to Usurp Pattern
We couldn’t find that file to show.