Skip to content

Instantly share code, notes, and snippets.

@ahmedrb
ahmedrb / pre-commit
Created April 23, 2011 12:43
git pre-commit hook to package gems if Gemfile is modified
#!/usr/bin/env ruby
# simple pre-commit hook to vendors gems using 'bundle package' if changes to
# Gemfile are detected. I use it to package private gems for use on Heroku
# using semi-colons to surpress console output from system calls
changes = `git status -s -uno`;
if changes =~ /M\s+Gemfile/
@ahmedrb
ahmedrb / gist:856243
Created March 5, 2011 09:11
simple css buttons mixin for sass
// based on http://css3-buttons.heroku.com/stylesheets/sass/_buttons.sass
// updated to use compass' own css3 mixins rather than custom ones
//
// usage:
//
// <a href="#" class="button">Foo</a>
// <input type="submit" class="button">Bar</a>
//
// .button
// +standard-button(red)
@ahmedrb
ahmedrb / routes.rb
Created January 30, 2011 14:00
adds a GET 'delete' action to all singular and plural routes by default
# puts this file in config/initializers
#
# adds GET /resource/:id/delete to all singular and plural routes
# works with the :only and :except options for resources() and resource()
module ActionDispatch::Routing::Mapper::Resources
class Resource
# nodoc
def default_actions_with_delete_action(*args)
actions = default_actions_without_delete_action(*args)