Getting a random record using datamapper
Thursday 11/27/2008 – Category: Uncategorized
Model.get(1+rand(Model.count))
You’ll have to have dm-aggregates for Model.count to work correctly
ruby strip vs strip!
Thursday 11/27/2008 – Category: Uncategorized
Sorry to disappoint, but this entry isn’t about strippers.
str.strip returns a copy of string str with with whitespace chopped off, while str.strip! returns the same string str or nil if the string wasn’t altered.
I didn’t realize str.strip! would return nil until I was getting a lot of empty strings back…
Using Monit to…monitor stuff
Tuesday 11/25/2008 – Category: Uncategorized
Monit is a useful tool that lets you monitor your server and run commands based on certain variables (ex: restart your mongrel instances if they grow > x MB). Plus, it comes with a nice web interface to quickly see your load averages and memory usage (easier than logging in and running top).
nginx+mongrel vs apache+passenger (+wp super cache)
Sunday 11/23/2008 – Category: Uncategorized
I’ve liked using Phusion Passenger as a stupid-easy deployment solution for Rails (and now merb) apps, but running three Rails apps and one Merb app on a Slicehost 256slice, things got kind of crowded. I had to set the PassengerMaxPoolSize variable to 2 in order to keep my free memory at an acceptable level, and [...]
Where does my time go?
Friday 11/21/2008 – Category: Uncategorized
I’ve been using RescueTime for awhile to track my usage trends and see how (un)productive I am over a certain period of time. Their web interface is pretty easy to use and it shows pretty graphs (see ma, I really do work!)
But part of me feels kinda weird having an app push updates to a [...]
Recent Posts
- Marble Paint
(Friday 02/4/2011 – 1 Comment) - More Flickr Original Updates
(Sunday 01/23/2011 – 13 Comments) - Flickr Original updates
(Saturday 08/7/2010 – 19 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 65 Comments)
