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 / .bashrc
Created May 3, 2011 04:00
bashrc to support RVM, including the default bashrc file
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
if [[ ! -z "PS1" ]] ; then
# This is your .bashrc (renamed to .bashrc_part2)
source ~/.bashrc_part2
fi
@joselo
joselo / UserFilePreferences
Created May 5, 2011 01:31
My default UserFilePreferences for Sublime2 Editor
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"file_exclude_patterns":
[
"*.png",
"*.gif",
".DS_Store",
".rspec",
"*sublime-project.sublime-project",
"config.ru",
@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.