code needs smileys J-_-L
index | fresh | irbtools | zucker | pws | github | ruby on ubuntu | euler
19.01.12
5 comments

pws: The ruby-powered command-line password manager

  • stores your passwords in a file on your disk
  • encrypts the file with a master password
  • is designed for every-day-use
  • is written in 234 lines of understandable Ruby code… Read it!
  • is tested with 222 Cucumber steps […]
07.12.11
6 comments

RubyBuntu -6- gedit 3! wtf? set it up for ruby/web development :)

So you’ve installed (or upgraded to) ubuntu 11.10 and everything looks great… Except – uh!, lots of gedit plugins are only compatible with gedit 2! But don’t be sad.. or angry.. This guide points out, how to, nevertheless, create a solid foundation that allows you getting prodcutive with gedit! […]

28.11.11

Why you should switch to 1.9: Three Ruby 1.8 bugs

Ruby 1.8 dies in June 2012. This post shows some small examples, why this is good ;) […]

24.10.11
3 comments

Pass multiple blocks to methods using named procs

codebrawl · gem · gist · hints · ruby · ruby1-9

My codebrawl entry (gist) got the 5th place (out of 20). Want to use it in real life :) […]

15.07.11 16.07.11

Three little tips for slimmer Rails migrations

gem · hints · one-liners · plugin · rails · rails2 · rails3 · ruby

Rails migrations are easy to understand and easy to write. However, you can save some unnecessary key strokes by applying these three tips :) […]

29.06.11

Building yet another terminal colors gem: term-ansicolor meets rainbow

irb · ruby

There are plenty terminal color gems out there. Now, there is one more. Why? […]

01.06.11

eurucamp: Tweak your Ruby consoles - 2011 edition

09.05.11
4 comments

Exploring the stdlib: logger

puts is great for a quick output, but when a script gets more complex or you want to offer a flexible executable, consider using the logger ;). Since the logger class is part of the Ruby standard library, it can be used everywhere, without installing any gems. And it’s very easy to use :D […]

31.03.11
6 comments

♥ .railsrc / rails console snippets

13 Rails-specific hints for your rails 3 console. […]

08.03.11 12.03.11
5 comments

Small Ruby CLI Improvements (Part 4): Edit Ruby Objects Using yaml

hints · irb · ruby

Somehow, I stumbled upon this useful little script by _why: Update […]

24.02.11 28.03.11

Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode

Hirb: “A mini view framework for console/irb that’s easy to use, even while under its influence. Console goodies include a no-wrap table, auto-pager, tree and menu.” now supports unicode in two ways:

┌───────────────────────────────────────────┬───────────────────────────────────────────────┐ │ Support for unicode full-width characters │ Unicode table characters instead of +/- chars │ └───────────────────────────────────────────┴───────────────────────────────────────────────┘ […]

27.01.11
2 comments

Small Ruby CLI Improvements (Part 2): Wirb!

Many people use irb with wirble. I also did.

I’ve been quite happy with it, but sometimes I noted that some symbols were displayed as : without the symbol name (e.g. in method name arrays) and that the representation of regexes looked quite strange.

This is why I’ve looked at the wirble tokenizer, fixed some bugs, liked it, extended it and created Wirb. These are the improvements: […]

22.01.11

Small Ruby CLI Improvements (Part 1): Command-line Regex Debugging

hints · irb · regex · ruby · zucker

This little method (now also available in zucker/debug) is useful for understanding and creating regexes: […]

18.12.10
4 comments

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! […]

24.11.10 03.12.10
12 comments

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. […]

10.11.10

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 […]
06.10.10 24.06.11
11 comments

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) […]

03.10.10 24.01.11
1 comment

Gem: clipboard

gem · ruby

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

03.10.10 04.10.10

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: […]

09.09.10 24.11.10

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

The next pack of Project Euler solutions. […]

04.09.10
3 comments

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 […]

01.09.10 02.09.10
6 comments

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

gem · hints · ruby · tutorial · zucker

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. […]

19.08.10 20.08.10

Do you know the official Ruby interpreter "goruby"?

fun · golf · regex · ruby · ruby1-9
##              ##    ##     ##    ##    ##    ####           ###        ##    ##
 ##            ##     ##     ##     ##  ##     ##  ##        ## ##        ##  ##
  ##    ##    ##      #########      ####      ##   ##     #########       ####
   ##  ####  ##       ##     ##       ##       ##  ##      ##     ##        ##
    ####  ####        ##     ##       ##       ####       ##       ##       ##

[…]
14.08.10 01.09.10

New features of Ruby Zucker version 2 and 3

gem · irb · ruby · ruby1-8 · ruby1-9 · zucker

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

05.08.10 20.08.10
2 comments

Introducing Ruby Zucker - a new syntactical sugar gem

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

30.07.10
4 comments

The multi mega method list

hints · irb · ruby

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. […]

15.07.10 24.11.10
2 comments

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. […]

14.07.10
3 comments

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! […]

08.07.10

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. […]

05.07.10 06.07.10
11 comments

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 :) […]

24.06.10 08.05.11
29 comments

The 28 Bytes of Ruby Joy!

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

24.06.10 01.06.11

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. […]

06.06.10 13.01.11

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. […]

25.05.10 06.06.10
3 comments

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! […]

29.04.10 07.12.11
18 comments

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! […]

29.04.10 06.10.10
2 comments

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. […]

29.04.10 29.06.11
27 comments

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… […]

29.04.10 30.11.11
23 comments

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

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

29.04.10 07.12.11
11 comments

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! […]

21.03.10
2 comments

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 ;) […]

18.01.10 24.11.10
5 comments

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. […]

06.12.09
2 comments

NoTabs

After editing some source files with different editors on different platforms, I had some troubles with automatically inserted tabs messing it all up.

This little script replaces all tabs with two spaces. […]

14.11.09 06.06.10

Rack::NoTags

rack · rails · regex · ruby · security · xml · xss

This is my submission for the CodeRack contest:

A middleware that removes < and > from all incoming requests. […]

24.10.09 18.11.09

Oh, this sweet and tasty syntactic sugar!

This article is written for people with experience in programming in general, but who are new to Ruby.
A German version is published in the offline magazine #2, a magazine by some students of TU Dresden.

The intention is to demonstrate some features of Ruby and show, what is so great about Ruby:

A clean syntax combined with the possibility to adapt the language to given requirements flexibly. […]

21.09.09 14.01.10
1 comment

Ruby Brainfuck golf [Update]

fun · golf · ruby · ruby1-8

Some days ago, I discovered a website – which is the most addicting one I know :) – codegolf.com. The goal is, to solve programming problems with as short code as possible.

As I said, it is addicting. You do not write better ruby code by golfing. But you can really improve the knowledge of the language. And it is fun :)

Brainfuck

After doing some of the other challenges I tried the brainfuck challenge.
Brainfuck is a Turing-complete esoteric programming language consisting only of 8 letters, operating on a 30000 cells-array. This is the hello world program:

>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

The goal is to build a interpreter. […]

15.09.09
1 comment

Quicksort in 5 minutes

Some time ago, I conducted a short presentation about Ruby. And to impress the audience, I did some live coding and implemented the quicksort algorithm in 5 minutes. They were impressed :) […]

09.09.09 21.06.10

Troubleshooting an aegis-permission problem

gem · hints · rails · ruby

In my current Rails project, I use the aegis gem for rights management. And I almost got mad, wondering, why it wouldn’t work.. […]

29.08.09 29.04.10

Playing with Dijkstra

About a year ago, some students at my university announced a little programming competition for students beginning studying IT, like me. The language could be chosen freely.

At this time, I had already done some C and PHP programming.. but I also had heard of Ruby and that Ruby is sooo cool. So I decided to learn the basics of Ruby by taking part… and it’s been the right decision! I fell in love with Ruby ;).

I publish my solution here. It is a good “try to understand what it does”-exercise for people new to Ruby or programming in general (or people doing Rails only all the time). […]

23.08.09

Create an offline version of the Ruby docs

When I began programming Ruby/Rails, I quickly found the online Ruby documentation at ruby-doc.org and the Rails API, which are both very useful. But unfortunately, one cannot be always online. In this blog post, I’ll demonstrate some ways to generate or get the docs offline and some hints on using them. […]

08.08.09 30.08.09

Converting decimal to binary integers: custom methods vs. to_i [Update]

At my last entry, a question arose about what is the most efficient way to convert integers between the bases 2 and 10: either using built-in ruby methods (and even do lightweight string-operations) or calculating it manually. I had to find out ;). So I have written a little benchmark program, which does the conversion in three different ways:

  1. using built-in to_i-magic
  2. calculating it by hand
  3. using sprintf

It stops the time each method needs to get the fastest. The result might be surprising. [Update: improved the custom methods] […]

01.08.09 15.06.10
4 comments

Storing an array of indices in an integer

Sometimes you have an array of indices. These might, for example, act as flags, whether some specific options are set or not. A nice way to store this list is, to store it in one single number. […]