Skip to content

Instantly share code, notes, and snippets.

View danielfone's full-sized avatar

Daniel Fone danielfone

View GitHub Profile
module SaveWithErrors
def self.prepended(base)
base.serialize :record_errors, Hash
base.after_validation :assign_errors
end
def save(*args)
super(*args) || save_anyway
end

List of NZ Beers worth sampling

An incomplete list.

Sessionable

  • Emerson's 1812 (many supermarkets)
  • Emerson's Bookbinder (good “session” ale)
  • Cassel's Best Bitter (from The Brewery)
  • Beer Baroness Lady Danger (from Pomeroy's)
@itspriddle
itspriddle / setup-git-bundler-merge-driver
Last active August 13, 2018 08:41
This script makes git automatically run `bundle install` when a merge conflict with Gemfile.lock occurs. Run it once per project to setup `.gitattributes` and `.gitconfig`
#!/usr/bin/env bash
# Usage: setup-git-bundler-merge-driver
# Help: Configures git to use a custom merge driver to resolve Gemfile.lock
# merge conflicts.
if [ ! -f Gemfile ]; then
echo 'No `Gemfile` found! Aborting'
exit 1
fi
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>