Xapian & Ruby Enterprise in Ubuntu

How to fix ‘No Ruby bindings for Xapian installed’ on Ubuntu after upgrading to RubyEnterprise

Posted on October 14, 2009 at 3:48 pm by Jordan Carter · Permalink · One Comment
In: Ruby on Rails · Tagged with: , , , ,

Map and to_proc to easier capitalize array of strings

["auckland", "christchurch", "wellington", "hamilton", "tauranga", "dunedin", "palmerston north", "hastings", "nelson", "napier", "rotorua", "new plymouth", "whangarei", "invercargill", "wanganui", "gisborne"].map(&:capitalize)

Posted on April 1, 2009 at 10:17 am by Jordan Carter · Permalink · 2 Comments
In: Uncategorized · Tagged with: , , , ,

Ruby on Rails – Easier enumerations (Select, Collect, Map) using Ampersand

a = [] # setup array
0.upto(100) do #just make up some array
a << rand(1000)
end
s = a.in_groups_of(6,false) # make it an array of arrays (so we can use the sort method on each element of the outer array)
s.collect(&:sort) #sort each array inside the outer array in one easy step

What are we looking at? the ‘&:’ is [...]

Posted on March 31, 2009 at 10:31 am by Jordan Carter · Permalink · One Comment
In: Uncategorized · Tagged with: , , , ,

Ruby trick – Save a sort for later, Reuse a sort block

Sort multiple arrays with a single block/proc

Posted on March 29, 2009 at 12:09 pm by Jordan Carter · Permalink · Leave a comment
In: Uncategorized · Tagged with: , , , ,