codegourmet

savory code and other culinary highlights

Screencasting With Ubuntu as GIF

| Comments

Sometimes I need to send someone instructions on how to use software.

Instead of fiddling with annotated screenshots, wouldn’t it be nice to just send an animated GIF via email? Also, I now can show off my struggles with Vim! ;)

Here’s a setup that I found on the internet and it works like a charm with my system (Ubuntu 14.04 LTS and xmonad).

Ruby 2.0 Not Compiling Due to Readline Error

| Comments

Ruby 2.0.0 didn’t compile anymore after reinstalling rbenv on my Ubuntu 14.04 system. The error message was only hinting at /tmp/ruby-build.xyz.log.

Inside the build log I found an error similar to this:

1
2
readline.c:1977:26: error: ‘Function’ undeclared (first use in this function)
     rl_pre_input_hook = (Function *)readline_pre_input_hook;

Integration Tests With Celluloid::IO, Part 2

| Comments

In the first post, we wrote an integration test setup for a Celluloid::IO application.

One remaining problem is that the tests are “absorbing” all exceptions that occur during worker execution, or are raising them some time later. This is because the workers can just crash internally and/or the worker thread is still running when the test is done.

Integration Tests With Celluloid::IO, Part 1

| Comments

While creating Celluloid based applications is more fun than you’d expect from multithreaded programming, testing them has some caveats.

Here’s how we did the test setup with MiniTest and as a bonus I’ll describe a hack to handle worker exceptions correctly in a second post

Vim Modifiable / Readonly Buffer

| Comments

Sometimes, vim shows an annoying warning saying

1
2
E21: Cannot make changes, 'modifiable' is off
Press ENTER or type command to continue

or:

1
2
Changing readonly file
Press ENTER or type command to continue

Ruby: Capturing and Mocking Stdout

| Comments

Sometimes, you want to assert that a method under test outputs some specific information to stdout. Or you want to silence all stdout from a library gone rogue (this happened to me once when I had to include a third-party library into a ruby C extension gem).

I wrote a Gem that does this, and MiniTest and RSpec already have matchers for this:

Vim: Staying on the Base Line

| Comments

Staying on the touch-typing base line (a, s, d, f, ..) is strongly promoted by the Vim movement keys - but :w, ctrl, escape and more tend to distract my hand position. Here are some of the steps I took to deal with this:

  • map , to Leader
  • map Space to ^
  • map Control-m to save all
  • dual-map Caps Lock
  • map jj to Escape in insert mode
  • remap window focus movement
  • map Escape-Escape to nohlsearch