Sliced Software

About

Thomas Mango writes software, has a bulldog, listens to Long Island Hardcore music and eats sandwiches.

He is currently working freelance projects as well as on his own project, Limited Pressing.

Software

PGnJ An intuitive Database Development Environment for Mac OS X.

Mobile LIRR An iPhone optimized Long Island Railroad scheduling application.

Trends An iPhone optimized Twitter Trends application. Get the current trends and their reason for trending on the go (data by What the Trend?).

A better Array#rand

I released a new plugin today, called rand. This plugin expands on the #rand method ActiveSupport adds to Array. As background, the rand method that Rails gives you, returns a single random value back from the array it’s called on.

>> [0, 1, 2, 3, 4].rand
=> 2
This rand plugin overrides the rand method so that you can pass in an integer value that corresponds to how many random values from the array you actually want back.
>> [0, 1, 2, 3, 4].rand(2)
=> [4, 0]

>> [0, 1, 2, 3, 4].rand(4)
=> [3, 0, 2, 1]
Additionally, the existing functionality is still in place so that if you don’t pass in a parameter, it still gives you back a single random value.

Looking for really old posts? Until they are here at tumblr, see here!