default_value_for Rails plugin: declaratively define default values for ActiveRecord models
We’ve just released default_value_for, a plugin for declaratively defining default values for ActiveRecord models.
We’ve just released default_value_for, a plugin for declaratively defining default values for ActiveRecord models.
Phusion has recently released a library for robust daemon management. Check it out. Description and tutorials are available on that page.
Passenger 1.0.5 has just been released. Please read the Phusion corporate blog for the announcement and upgrade instructions.
I totally fell in love with Ruby ever since I started using it more than a year ago. The language’s syntax and constructs are very, very elegant (with a few exceptions… I’m talking about you, StringIO.new.is_a?(IO) == false). The ‘do’ blocks are simply brilliant, they make working with closures a breeze and aesthetically pleasing. Ruby’s Array, Enumerable and Hash classes make heavy use of this.
Compared to Ruby’s syntax, Perl’s seems like something from the 80s. Perl is often the target of “my-code-is-more-unreadable-than-yours-but-I-can-do-it-in-fewer-lines” jokes. I can write readable and maintainable code, but no matter what I do, it’s still nowhere near Ruby’s level. All the referencing and dereferencing of arrrays and hashes makes things ugly. %, $ and @ everywhere, urgh. And working with collections takes more code than in Ruby. I can’t tell you how many times I had to write stuff like this:
In Ruby I can just do:
There’s List::Util but they deliberately left out the ‘any’ function because it’s “easy to implement”. Urgh. -_-
I write a lot of text parsers in Perl. And each time I have to manually strip newlines from a read line with:
Seriously, why can’t I call ‘$foo->strip()’ or something like in Python or Ruby?
And print(). In 99% of the cases I want to print a newline as well, so I have to write print "$foo\n"; Why is there no puts()-like function that automatically prints the newline as well? It would save me a few keystrokes.
But no more. I’ve had enough. Enter the Peanuts library. Now you can write:
This would print “hello!, world!\n”.
Other Ruby-isms include:
The source code is at this SVN repository:
http://public.railsplugins.net/repos/peanuts/trunk
It is licensed under the MIT license.

Mikuru – named after Asahina Mikuru from The Melancholy of Haruhi Suzumiya – is an extremely simple image gallery generator. Its key features are:
I wrote this because I went to Abunai last weekend, and I took 150 pictures. I didn’t feel like setting up a full blown gallery system such as Gallery, so I wrote this simple fire-and-forget image gallery generator.
You put a bunch of pictures in a folder, run Mikuru, and it’ll generate an ‘index.html’ as well as a set of thumbnails. There are no other generated files. Simply upload index.html, the thumbnails and the pictures to a web server, and you’re ready to go.
Here’s an example usage session:
$ ls DSCN001.JPG DSCN002.JPG DSCN003.JPG DSCN004.JPG DSCN005.JPG DSCN006.JPG $ mikuru MKDIR thumbnails WRITE thumbnails/DSCN001.JPG WRITE thumbnails/DSCN002.JPG WRITE thumbnails/DSCN003.JPG WRITE thumbnails/DSCN004.JPG WRITE thumbnails/DSCN005.JPG WRITE thumbnails/DSCN006.JPG WRITE index.html $ scp -r * www.somehost.com:public_html/my_gallery/
Click here for a demo image gallery.
Version 1.0.0
Requires Ruby and RMagick.