Quick win – Cycle spacing in Emacs to quickly remove whitespace

When working on a piece of code it very common that you reformat it several times. You split lines that are too long into multiple lines. Refactoring of some parts makes the code shorter, and so on. Whenever you combine two lines into one you usually get a bunch of spaces between the end of the original line and the beginning of the line you added to it. How much depends on the amount of indentation of the added line. To quickly and easily clean up that mess there a nifty function in Emacs. It’s called cycle-spacing and it will remove all spaces except one between two characters. Try it out by running M-x cycle-spacing.

• • •

Leveraging Emacs macros to make powerful changes to your code

Today I want to talk a little about a really nice feature in Emacs.
That feature is keyboard macros. The work by recording your actions on
the keyboard and then replaying those actions. These macros can then be
combined with C-u to run the following command, in this case the
just recorded macro, num number of times.

• • •

Directory local settings in Emacs

Here’s a neat new trick that I just learned. I’m using the minor mode Projectile to quickly navigate through git repositories. I have one small issue though. The process of generating the list of files in the directory takes quite a while when your repository contains several thousand files.

• • •

Ruby blocks explained

My initial plan for this post was to write about the Ruby module Enumerable, but I realized that it would be a good idea to introduce blocks first. We’re going to need to have a good understanding of what blocks are before we talk about Enumerable.

• • •

The Passionate Programmer by Chad Fowler

The Passionate Programmer was published in 2009 and I’ve had it sitting in my bookshelf for more than six months. I asked myself; why didn’t I read this earlier? It’s a book for any developer who wants more from their career than to just sit at their desk, write code from nine to five and then go home. The underpinnings of this book is that you should treat your career as a business and you should build and market it just as seriously as you would with any other critical product.

• • •

Why You Should Use Referential Integrity in Your Web Application

When you build a database backed application it’s paramount that you keep your data in a sane state. The vast majority of the value our customers gain from our applications is in the data itself. Without it we’re left with a collection of nice, but empty pages. We need to be aware of this since it’s easy to create cracks in which errors slip through, leaving us with a mess of orphaned records and other messy data.

• • •

John Sonmez’s blog course

Today I’ll talk about something a bit different; the reason why I started writing this blog in the first place. That reason is John Sonmez, who runs the Simple Programmer. I first heard of John on episode 187 of the Ruby Rogues where he talked about “Marketing Yourself as a Software Developer”. John succeeded in making me excited about the subject and I have since started this blog and promised myself to write at least one post every week. I really felt that John was on to something and it connects nicely with articles I’ve been reading about controlling your public profile and being seen. Do you have control over your public profile? What shows up when you google your name?

• • •

Sandi Metz’s Rules for How to Write Better Software

Sandi Metz is one of my many role models in software development. Her book “Practical Object-Oriented Design in Ruby” is a must read for any programmer who wants to write better object-oriented code. It’s short, clear and to the point and it made me even more enthusiastic about writing clean and eloquent code driven by empathy.

• • •