Skip to content

Instantly share code, notes, and snippets.

View matthewford's full-sized avatar

Matthew Ford matthewford

View GitHub Profile
## Rails development best practices
# An #RMM alternative, open and collaborative set of development practices we can adhere to.
* Distributed Version Control over relying on the File System
* Business Logic in the Models over being spread throughout the MVC layers
* RESTful Architecture over overloaded controllers
* KISS - Short methods with descriptive names
* Tests/Specs covering each layer of MVC and the whole stack
* Document the setup procedure (freeze dependancies where possible)
@matthewford
matthewford / deploy.rb
Created January 19, 2009 12:14
Git SHA1 of HEAD in your Rails App
after "deploy:update_code", "deploy:write_sha1"
namespace :deploy do
desc "write sha1 to file"
task :write_sha1 do
run "cd #{latest_release} && git show-ref --heads --hash=7 > #{latest_release}/config/HEAD"
end
end
From f81121312509f757694e1af7b19a7f7bf5f9cdac Mon Sep 17 00:00:00 2001
From: Matthew Ford <[email protected]>
Date: Fri, 7 Nov 2008 15:00:41 +0000
Subject: [PATCH] avoid calling destroy on nil
---
dm-tags/lib/dm-tags/dm_tags.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dm-tags/lib/dm-tags/dm_tags.rb b/dm-tags/lib/dm-tags/dm_tags.rb
@matthewford
matthewford / Detect Duplicates with progressbar
Created October 30, 2008 13:49
Detect Duplicates with progressbar
#
# Ruby/ProgressBar - a text progress bar library
#
# Copyright (C) 2001-2005 Satoru Takabayashi <[email protected]>
# All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms
# of Ruby's license.
#
#how i'd imagine this working, and how to just deal with the ticket obj, although just tested and this doesn't quite work. will see if i can fix it tomorrow
class Ticket < Sequel::Model
set_schema do
foreign_key :ticket_detail_id, :table => :ticket_detail
# integer :ticket_detail_version
end
is(:versioned_fact, {:dimensions => [TicketDetail]})
one_to_many :ticket_details