Ruby

Ruby

Ruby exit, exit!, SystemExit and at_exit blunder

Recently, we hit a problem with Ruby's exit command. If something went horribly wrong and it made no sense for our application to continue in its current state then we would abort with exit 1. We use supervisord to manage processes, so in this case when we exited with exit status of 1, supervisord would assume something went wrong and restart the process for us. Or at least that is what we thought...

Read
Ruby

Colorful Ruby Code In HTML Using CodeRay

In this blog post I will demonstrate a quick and easy way I have found to syntax highlight your Ruby code in pretty colors for your blog posts or other HTML-based display purposes. Please note, this blog post is designed for use with color monitors only, obviously. The focus of this post is Ruby, but this method also applies for syntax highlighting C, C++, Python, CSS, Clojure, diff, Groovy, HAML, ERB, Java, JavaScript, PHP, SQL, XML and YAML.

Read
Ruby

Zero-Copy. Transfer Data Faster In Ruby

In this post I will explain the concept behind zero-copy, which is feature of the Linux allowing for faster transfer of data between pipes, file-descriptors and sockets. I will demonstrate how you can use this functionality in your Ruby projects using a code example. This functionality has been implemented in C, Java, Ruby, Perl and nameless other languages, but in this blog I will focus on the Ruby usage.

Read
Ruby

Tools for Testing Ruby On Rails

I'm getting stuck into learning Ruby On Rails and the topic of which tools / frameworks to use for testing came up. Here's some notes. I'll be reading up on

Read