duncanbeevers
Rapid Test Feedback
over 3 years ago by duncanbeevers on dweebd.
Test::Unit doesn’t output the specifics of test failure and errors until the entire suite as completed running. With a large enough (read: slow) suite...
Force indices
over 3 years ago by duncanbeevers on dweebd.
When trying to set up indices on a set of mysql tables, a number of annoying errors can occur that necessitate re-running a migration. This simple hack...
Ensure return
over 3 years ago by duncanbeevers on dweebd.
def foo return 1 ensure return 2 end foo => 2...
MySQL varbinary columns in Rails migrations
over 3 years ago by duncanbeevers on dweebd.
In a Rails Migration, specifying a column as binary generates a blob column. Blob columns, unfortunately, are allocated differently than any other MySQL...
Hash key rewrite
over 3 years ago by duncanbeevers on dweebd.
Props to Jeremy Voorhis for this cool and simple Hash maneuver. class Hash def rewrite mapping inject({}) do |rewritten_hash, (original_key, value...
Token prefix trie store
over 3 years ago by duncanbeevers on dweebd.
class TrieStoreTest < Test::Unit::TestCase def setup @t = TrieStore.new end  def test_should_insert @t.insert('hello', 1) end  def...
RailsConf Europe Presentation
over 3 years ago by duncanbeevers on dweebd.
Despite an unfortunate fainting spell at the end of the presentation, overall it went alright. The slides are available here....
Copenhagen South Harbor
over 3 years ago by duncanbeevers on dweebd.
Modeling bidirectional graph edges in Rails
over 3 years ago by duncanbeevers on dweebd.
It is frequently desirable to represent bidirectional relationships in web applications, and simple databases are not immediately suitable for this information...
English Ordinals in Ruby
~3 years ago by duncanbeevers on dweebd.
class Numeric def to_ordinal to_i.to_s + ((11..13) === (n = to_i.abs % 100) ? 'th' : { 1 => 'st', 2 => 'nd', 3 => 'rd' }.fetch(n % 10, 'th'end...
