Working with Ruby
Hi, I am Jan. This is my old Ruby blog. I still post about Ruby, but I now do it on idiosyncratic-ruby.com. You should also install Irbtools to improve your IRB.

ripl: Why should you use an irb alternative?

What does it mean when the guy who blogged about irb’s details and wrote most of the successful irb gems (hirb, bond, boson) decides to implement his own irb alternative? There must be something wrong with irb!

…read

Use fresh Ruby as your shell!

We love Ruby. And we love the command line. So… the shell needs to be rubyfied ;).

Fresh is a new gem, trying to achieve this.

Updated for fresh version 0.2.0.

…read

IRB rockets and colors

Introducing the fancy_irb gem:

  • Use fancy colors! You can colorize the prompts, irb errors, stderr and stdout
  • Output results as Ruby comments
  • Enhance your output value using procs

Tutorial: Build your own password safe with Ruby!

There are many implementations of password managers/safes out there. But lots of them are black boxes, either because they are not open source, or because they have to much features and it gets complicated to understand the source (which is most likely not written in a happy programming language). You don’t know, what really happens with your passwords. So…

Do it yourself!
Do it with Ruby!
Do it in less than 250 lines ;)

…read

irbtools / Release the power of irb!

Equipped with some tools discussed at the germany.rb 2010 user group meetup, I’ve played around with my ~/.irbrc and put together a little meta gem for some useful irb tools (github)

…read

Gem: clipboard

The clipboard gem allows you to access the clipboard on Liunx, MacOS and Windows.

…read

Requirements: A Mini RubyGems plugin

The .gemspec file of a gem allows to specify requirements for that gem – but usually you do not get to see them. These five lines patch RubyGems, so that gem displays the requirements of a gem after it has been installed:

…read

Project Euler 19, 20, 21, 22, 23, 24, 25 (Ruby)

The next pack of Project Euler solutions.

…read

Little heplers for Ruby print debugging

Not everyone likes debuggers. I rather print the debug values myself – it works and I do not need to learn a debugger :P

…read

How to properly check for your Ruby interpreter, version and OS

Zucker 4 adds accessors to some environment information:

  • OS: returns the current operating system
  • RubyEngine: returns the current Ruby implementation
  • RubyVersion: returns the current Ruby version

And here is how it works.

…read

Do you know the official Ruby interpreter "goruby"?

##              ##    ##     ##    ##    ##    ####           ###        ##    ##
 ##            ##     ##     ##     ##  ##     ##  ##        ## ##        ##  ##
  ##    ##    ##      #########      ####      ##   ##     #########       ####
   ##  ####  ##       ##     ##       ##       ##  ##      ##     ##        ##
    ####  ####        ##     ##       ##       ####       ##       ##       ##

…read

New features of Ruby Zucker version 2 and 3

The Zucker gem has gotten some new features. Installation is as easy as
 gem install zucker
and
 require 'zucker/all'

…read

Introducing Ruby Zucker - a new syntactical sugar gem

Zucker is a collection of lightweight scripts (cubes) that make Ruby even more beautiful: rubyzucker.info

…read

The multi mega method list

One of my favourite ways of learning something about existing code is to load it into irb and play around with it. You are able to ask every object in irb what it can do. It is as easy as you just asking for methods or public_methods and the object will show its abilities. But often you get spammed by Object or irb methods that you rarely want to use.

…read

Project Euler 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 (Ruby)

More solutions for the projecteuler.net problems. Some of them are solved using 1.9.2 features.

…read

Become a Proc Star!

One useful (and funny) feature of Ruby is the Symbol#to_proc method that lets you write concise code like this: %w|1 2 3 4|.map(&:to_i). Almost everyone who knows this feature loves it ;). However, the use cases are pretty limited, because in most cases you need to pass parameters!

…read

The has_many_booleans Rails plugin

has_many_booleans is an ActiveRecord plugin which creates virtual boolean attributes for a model. When the object gets saved, the plugin transforms all attributes into a single integer, using a bitset. So you can easily add new attributes without changing the database structure.

…read

New Array and Enumerable methods in Ruby 1.9.2: keep_if, chunk...

In Ruby, dealing with Arrays and similar objects is pretty fun. And we have gotten more possibilities with Ruby 1.9.2 :)

…read

The 28 Bytes of Ruby Joy!

The 28 Bytes of Ruby Joy will notably clean up your code:

…read

Just another "Ruby code is beautiful" presentation ;)

These the slides for my proseminary about the Ruby syntax. It is loosely based on an essay by Yukihiro Matsumoto which is published in the O’Reilly book Beautiful Code. It is released under a creative commons license.

…read

Upgrading to Rails 3: Obstacles and helper scripts

Transferring an existing project to Rails 3 is not that hard, but it usually cannot be done in 5 minutes.

…read

gedit external tools: Ruby helpers, git integration and more

With the easy-to-use (and pre-installed) command line utility zenity, it is pretty simple to create useful external tools for gedit!

…read

RubyBuntu -4- Make gedit better than any IDE ;)

You can, of course, use an IDE for coding – but reconsider it: After hours of initialization, it tries to do everything for you… Somewhere in the never ending menu jungle… And you need to click all the time… Stop! Focus on the gist! You want to write code!

…read

RubyBuntu -3- Be one with your command line!

Most Ruby programmers know: Many things can be done in much less time on the command line. To become more productive, you should take the 10 minutes to configure some basic settings.

…read

RubyBuntu -2- Troubleshooting common Ruby ubuntu problems

A common Ruby experience on ubuntu: You get some stupid error, saying something would be missing – and you don’t know what to do…

…read

RubyBuntu -1- Installing Ruby (and Rails) on ubuntu

Installing Ruby/Rails on ubuntu is not hard, but some little obstacles might be confusing.

…read

You don't need a MacBook to code Ruby and Rails ;)

No, I am not an Apple hater. But I want to point out, that it is possible to turn an ubuntu into a sweet Ruby development environment – without TextMate!

…read

SHA-256

This is a Ruby implentation of the SHA-256 hashing algorithm. Truth be told: It is almost a plain copy of the Wikipedia pseudocode ;)

…read

Project Euler 1-5 (Ruby)

projecteuler.net tries to get you thinking about how to solve mathematical problems by programming. Here are the first five problems, solved in Ruby, including comments.

…read