Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
@joselo
joselo / .gitconfig
Created May 9, 2011 22:26
My .gitconfig file
[user]
name = Your Name
email = youremail@example.com
[alias]
ci = commit
co = checkout
st = status
br = branch
pl = pull
@joselo
joselo / gist:1001862
Created June 1, 2011 06:04
List of status codes and their symbols
ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE
100 = :continue
101 = :switching_protocols
102 = :processing
200 = :ok
201 = :created
202 = :accepted
203 = :non_authoritative_information
204 = :no_content
@joselo
joselo / gist:1017075
Created June 9, 2011 16:14 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
def publish
if approved?
if !is_for_the_future?
publish!
if publish_in_twitter
if result = publish_on_twitter
self.twitter_status = result
end
end
save!
@joselo
joselo / gist:1028210
Created June 15, 2011 21:46
Configuration for MailCatcher
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => 'localhost',
:port => 1025
}
@joselo
joselo / gist:1044293
Created June 24, 2011 05:51 — forked from bryckbost/gist:1040263
Capybara 1.0 and Chrome
# env.rb
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Download chromedriver from http://code.google.com/p/selenium/downloads/list
mv chromedriver to /usr/local/bin so it's in your path.
@joselo
joselo / Rakefile
Created June 30, 2011 22:36 — forked from febuiles/Rakefile
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'whiskey_disk/rake'
require 'resque/tasks'
Haystack::Application.load_tasks
@joselo
joselo / .rvmrc
Created July 24, 2011 22:08
.rvmrc demo file
if [[ -n "$rvm_environments_path" && -s "$rvm_environments_path/ruby-1.9.2-p180@project_name" ]] ; then
\. "$rvm_environments_path/ruby-1.9.2-p180@project_name"
else
rvm --create use "ruby-1.9.2-p180@project_name"
fi
@joselo
joselo / I18n devise es
Created August 9, 2011 03:44 — forked from scambra/I18n devise es
devise I18n file in spanish
es:
errors:
messages:
not_found: 'no encontrado'
already_confirmed: 'ya ha sido confirmada'
not_locked: 'no está bloqueada'
expired: "ha caducado, por favor pide uno nuevo"
not_saved:
one: "1 error evitó guardar este %{resource}:"
other: "%{count} errores evitaron guardar este %{resource}:"
@joselo
joselo / project.js
Created August 19, 2011 23:48
Write Javascripts as an object
var project;
$(function(){
var Project = function(){
var that = this;
var setupProject = function(){
};
that.someMethod = function(){