Hidden abstractions in the Diamond Kata

Hidden abstractions in the Diamond Kata The other day my colleagues and I were doing the “Diamond Kata”. If you haven’t heard about code katas yet: it’s a coding exercise you’re supposed to do repeatedly in order to hone your skills. Each time, you might want to try different approaches, different programming languages or coding…

Boy Scouts and Yaks

The Boy Scout Rule Over time, code bases accumulate cruft and become hard to maintain and small changes take considerable effort. Code does not become complex over night, it happens slowly, line by line, feature by feature. And it’s not carelessness that makes it happen: just the work of hard-working people, building functionality on top…

Using flymake to check erb templates

Live syntax checking code in Emacs with flymake is extremely useful. It’s quite easy to use for syntax checking scripting languages or for running code analysis tools in the background. Flymake’s initial goal, however, was syntax checking compiled languages like C by running a custom make target. The flexibility needed to make all of this…

Setting default-directory for Mercurial MQ patches in Emacs

Emacs’ diff-mode is a great tool to work with patches. You can move inside a patch by files or by hunks, it highlights the changes in each line and you can apply and revert individual hunks. However, diff-mode doesn’t work out-of-the-box with Mercurial’s MQ extension. To make it work, we first have to make Emacs…

Recovering data from a broken NTFS hard drive

Today I want to tell you about my recent adventure in data recovery. A friend of mine had a broken USB disk that was no longer readable. The single 230 GB partition was formatted with NTFS and neither Windows nor Ubuntu (with the NTFS-3g driver, I assume) were willing to read it. This disk contained…

Tiling window managers talk

I just finished the english translation of the speaker notes for my talk about tiling window managers I gave at the C-Base for the Ubuntu Berlin user group last thursday. Here are the original notes in german and here’s the english translation. As for my last few talks, I took my notes down with org-mode,…

Showing the current directory in Emacs’ mode line

Today I got tired of always looking up, where all these little files named “_show.rhtml”, “_list.rhtml” and their ilk are living, and patched the emacs mode line to include the last element of the current buffer’s directory. http://www.emacswiki.org/cgi-bin/wiki/ModeLineDirtrack describes something very similar, but it repeats the whole mode line definition of mode-line-format, which might break…

Live syntax-checking JavaScript with Emacs

There are quite some options for doing live syntax checks from within Emacs. A good one is using Steve Yegge’s relatively new js2-mode for javascript editing which has a javascript parser built in. But that is not what this blog post will be about. The other option is to use flymake with some command line…

Varnish, a faster Squid

I just stumbled across Varnish, an HTTP cache and modern alternative to Squid. The config file is compiled into a shared library at startup, logging is done in-memory and paging out unused pages to disk is left to the OS. With squid, an unused cached page is explicitly written to disk by the proxy, while…