Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
#!/bin/sh
POSTGISCONTRIB_PATH=`pg_config --sharedir`/contrib
POSTGIS=$(find $POSTGISCONTRIB_PATH -name 'postgis.sql')
POSTGIS_COMMENTS=$(find $POSTGISCONTRIB_PATH -name 'postgis_comments.sql')
POSTGIS_SPATIAL=$(find $POSTGISCONTRIB_PATH -name 'spatial_ref_sys.sql')
if [ -z "$POSTGIS" ] || [ -z "$POSTGIS_SPATIAL" ]; then
echo " * Not found postgis contrib files."
exit 1
@joselo
joselo / Gemfile
Created April 23, 2011 01:34 — forked from rmoriz/Gemfile
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
@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
@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 / 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 / wait_until.rb
Created August 26, 2011 02:46 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
@joselo
joselo / spec_helper.rb
Created September 12, 2011 22:02 — forked from ryanb/spec_helper.rb
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
@joselo
joselo / Gemfile
Created November 7, 2011 02:12 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass'
end
@joselo
joselo / elements.md
Created November 19, 2011 18:04 — forked from soveran/elements.md
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."