Home Blog

More RubyMine Shortcuts for Faster Development

RubyMine isn't vim but you can still use keyboard shortcuts to speed things up. Here are a few more of my favorite keyboard shortcuts. Shift + Esc Hides the last active window.  This is especially helpful when you want to hide the testing window or the project window so that most of your screen is only code windows Ctrl + Alt +...

Refactoring isn’t just for code

Earlier today, I came across this post where screenwriter John August 'refactors' Katy Perry's recent single Roar . It is interesting to see how he goes through the process of coming up with better lyrics by trying several intermediate steps as well as trying to identify the true intention of the lyrics in the process. Hopefully you can get something from the post...

Using Ruby’s Scan Method to Transform Strings

In the last post, I came across the line below that worked fine but I wanted to make it more compact and introduce some reusability for the future. The problem that needed to be solved was to take a three character string and convert it to a six character string by duplicating each of the characters while keeping the duplicated...

Refactoring Untested Case Statements in Ruby

I recently came across a small Sinatra app called PixelHoldr that generates placeholder images for your site based on the options you pass in through the url. This is a handy little addition to a web developers arsenal so I decided to take a look at the code. There isn't a lot of code necessary to run the app but...

A Few of My favorite RubyMine Shortcuts to Speed Up Development

As a developer on the Windows platform, it's very difficult to stop reaching for the mouse but I've been trying to wean myself from the mouse as much as possible.  Here are a few of my favorite RubyMine shortcuts that have helped. Ctrl + W Selects the nearest word.  Repeatedly pressing them will select increasingly larger blocks of words. Ctrl + / Toggle...

Refactoring the CategoryList class in Discourse

The CategoryList class in Discourse provides a good opportunity to bring up an issue that you might come across often, which is that the method that needs refactoring is a private method.  In this case, the CategoryList#add_uncategorized method is private but is in need of refactoring to break apart the many different tasks the method is performing. This could be...

Speeding up Ruby Development on Windows using RubyMine

On many corners of the internet if you mention that you do Ruby on Rails development on Windows, you will immediately feel the earth shaking as the community starts laughing in unison and yelling at you to make the switch to a more Ruby-friendly platform. I haven't made the switch away from Windows, and yes, there are quite a few...

Tell, Don’t Ask. Refactoring the SearchObserver class in Discourse

The latest class I came across in the Discourse code base provides a good opportunity to demonstrate the idea of "Tell, don't ask".  After seeing Sandi Metz's talk at Ancient City Ruby, I've been very conscious of limiting any type checks or a lot of conditionals that collect a bunch of different logic in one method. The starting point of...

Extracting the InviteRedeemer class from the Invite model in Discourse – Part 3

The results of previous post left us in decent shape to finish up the refactoring of the InviteRedeemer#redeem method.  The gist below shows the starting point for this portion of the refactoring. The private methods are left out for brevity. The first thing to tackle is the multiple assignments to the result variable.  The first change is to replace the nil...

Extracting the InviteRedeemer class from the Invite model in Discourse – Part 2

In the previous post, the InviteRedeemer struct was extracted in order to isolate the functionality required to redeem an invite.  When we left off, the redeem method had been moved to InviteRedeemer and all the tests were passing which gives the assurance that we have preserved all of the functionality required. The starting point for the next steps are based...