"your site doesn't look too good in (x) browser"

Courtenay : November 12th, 2005

I'm trying to actively discourage you from actually visitng the site. You're supposed to be reading it via rss. In other news,

class Array
  def smoosh
    self.flatten.compact.uniq
  end
end
lets you do

@somevar = [@somevar, stuff, [other, stuff]]
in lots of different views so you can dynamically build a list of stylesheets or included javascripts then smoosh it all together later for a nice flat list. And while we're extending ruby,

class Hash
  def to_sql
    sql = keys.sort {|a,b| a.to_s<=>b.to_s}.inject([[]]) do |arr, key|
      arr[0] << "#{key} = ?"
      arr << self[key]
    end
    [sql[0].join(' AND ')] + sql[1..-1]
  end
end

conditions = { :somekey => 'value',  :someotherkey => 'othervalue }

find(:all, :conditions => conditions.to_sql)
This lets you do all kinds of dynamic sql jiggery-pokery.

Sorry, comments are closed for this article.