Skip to content

Instantly share code, notes, and snippets.

Fabio Rehm fgrehm

Block or report user

Report or block fgrehm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View psqlfix.sh
if ! $(psql template1 -c 'SHOW SERVER_ENCODING' | grep -q UTF8); then
psql postgres -c "update pg_database set datallowconn = TRUE where datname = 'template0';"
psql template0 -c "update pg_database set datistemplate = FALSE where datname = 'template1';"
psql template0 -c "drop database template1;"
psql template0 -c "create database template1 with template = template0 encoding = 'UTF8';"
psql template0 -c "update pg_database set datistemplate = TRUE where datname = 'template1';"
psql template1 -c "update pg_database set datallowconn = FALSE where datname = 'template0';"
fi
View en.yml
en:
activemodel:
errors:
messages:
invalid_url: "must be a valid URL"
@fgrehm
fgrehm / deploy.rake
Last active Jul 27, 2018 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
View deploy.rake
# Deploy and rollback on Heroku in staging and production
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP'
STAGING_APP = 'YOUR_STAGING_APP'
REMOTE = ENV["REMOTE_HOST"] || "git@heroku.com"
def heroku_cmd(cmd)
Bundler.with_clean_env do
sh "heroku #{cmd}"
@fgrehm
fgrehm / ClientSideValidations_TwitterBoostrap_SimpleForm.coffee Script to Make Client Side Validations Work w/ Twitter Bootstrap & Simple Form
View ClientSideValidations_TwitterBoostrap_SimpleForm.coffee
jQuery ($) ->
$("div.control-group").focusout ->
$this = $(this)
if !$this.hasClass("error")
$this.addClass("success")
ClientSideValidations.formBuilders['SimpleForm::FormBuilder'].wrappers.bootstrap =
add: (element, settings, message) ->
wrapper = element.closest(".#{settings.wrapper_class}")
if element.data('valid') != false
@fgrehm
fgrehm / Results JRuby
Created Mar 9, 2012 — forked from sam/gist:2002262
Router Benchmark
View Results JRuby
Rehearsal -------------------------------------------------------------
INSERTION STATIC : Tree 0.334000 0.000000 0.334000 ( 0.334000)
INSERTION STATIC : Regexp 0.244000 0.000000 0.244000 ( 0.244000)
MATCHING STATIC : Tree 1.297000 0.000000 1.297000 ( 1.297000)
MATCHING STATIC : Regexp 13.382000 0.000000 13.382000 ( 13.382000)
--------------------------------------------------- total: 15.257000sec
user system total real
INSERTION STATIC : Tree 0.045000 0.000000 0.045000 ( 0.045000)
INSERTION STATIC : Regexp 0.106000 0.000000 0.106000 ( 0.106000)
View gist:186797
class Address # Our custom, embedded-value type
accessor :address => String
accessor :address_2 => String
accessor :city => String
accessor :state => String
accessor :zip_code => String
orm.map_type do |signature, types|
signature.from [self]
signature.typecast_left method(:__load__)
You can’t perform that action at this time.