Ruby-Tricks

3 New Date and Time Libraries for Rubyists

In the UK there's a cliché that goes: "You wait hours for a bus, and then three come along at once!" So it went with these three Ruby date and time libraries. They all made an appearance on RubyFlow last week and are all useful in their own ways, depending on how you're working with dates and times.

Read more →

Ruby Techniques Revealed: Autoload

monster-with-torch.jpgThere's plenty of stuff in Ruby that I've either not noticed before, noticed but forgotten about, or otherwise failed to realize the utility of. Add to that all the awesome Ruby tricks and techniques I'm seeing in people's code over on Github lately and.. we need a new series here: Ruby Techniques Revealed!

Read more →

bdb: Improved Ruby Bindings for Berkeley DB

berkdb.png Berkeley DB is a high performance database system initially developed in the early 1990s. It's not an SQL driven database engine - it just stores data in key/value pairs - but BDB is very fast, available to use on most operating systems, and is dual licensed for open source and commercial use. It has several benefits to just using a flat file or a PStore: transactions, fine-grained locking, replication, and hot backups, for starters.

Read more →

Roxy – An Object Proxying Library for Ruby

roxy-new.pngWhen you want your objects to refer to / have associations with other objects, it can quickly become a complex procedure. Ryan Daigle to the rescue! Ryan has built Roxy, a "Ruby Proxy-Object Library." He's also put together an awesome blog post with the motivation for developing Roxy and some code examples showing how it works. Roxy gives you the ability to add some rather ActiveRecord-esque functionality to your classes and their instances.

Read more →

Nokogiri: A Faster, Better HTML and XML Parser for Ruby (than Hpricot)

html-xml.pngYesterday, Aaron Patterson (@tenderlove) and Mike Dalessio released Nokogiri (Github repository), a new HTML and XML parser for Ruby. It "parses and searches XML/HTML faster than Hpricot" (Hpricot being the current de facto Ruby HTML parser) and boasts XPath support, CSS3 selector support (a big deal, because CSS3 selectors are mega powerful) and the ability to be used as a "drop in" replacement for Hpricot.

Read more →

BOSSMan: Build Your Own Search Engine With Yahoo And Ruby

yahooboss.gifRecently, Yahoo! launched BOSS - the "Build Your Own Search Service." In all but name, it appears very similar to their older Yahoo! Search API, as it allows you to query Yahoo's search index programatically. Under the surface though, Yahoo has removed the 5,000 query per day limit, you're unrestricted in how you present the data returned, you can re-order the data, and no attribution is required.

Read more →

Six Quick Optimization Tips for the Ruby Interpreter

Ilya Grigorik of Igvita has put together a great article called 6 Optimization Tips for Ruby MRI. In it, he walks through six different things you can do to improve the performance of your code when running on the regular Ruby interpreter (MRI). For example, interpolation is quicker than concatenation when working with strings, destructive operations prevent wasteful object duplication, and hand-written blocks are a lot faster than Symbol#to_proc.

Read more →

21 Ruby Tricks You Should Be Using In Your Own Code

Writing for Ruby Inside, I get to see a lot of Ruby code. Most is good, but sometimes we forget some of Ruby's shortcuts and tricks and reinvent the wheel instead. In this post I present 21 different Ruby "tricks," from those that most experienced developers use every day to the more obscure. Whatever your level, a refresh may help you the next time you encounter certain coding scenarios.

Read more →