Refactoring Rails Routes

Today I want to share a quick Ruby on Rails tip that I have used in the past and just used again in a recently inherited codebase.

The general problem under consideration is when you have route specifications where you want to change the syntax, but you didn’t want to change how the application works. I had done this in the past when upgrading a Rails app from version 2 to version 3, and yesterday I wanted to make some route changes to reduce deprecation warnings at the beginning of test runs.

In this case, I was getting some deprecation warnings about the syntax of the route. For example:

DEPRECATION WARNING: Defining a route where `to` is a controller without an action is deprecated. ...

So I wanted to fix the underlying issue but leave the routes otherwise unchanged.

Read on →

How to Actually Publish More Things

I recently published a post to my blog newsletter for the first time in a year, and mentioned a writing group that I had started. One of my readers asked for more details about it. So in this post I’ll talk about how our small writing group of around ten people helps keep each other accountable and encourages each other to write more.

The beginning

In August 2015, I decided to write more and more regularly. My writing backlog had increased quite a bit but I was not paring it down much. I had some recent experiences with a weekly fitness challenge and a weekly social media challenge (details to come), so figured something like a weekly writing challenge would work well. Those challenges showed that social accountability helps me stay focused on a goal. Also, setting up a system where I need to do something each week is flexible enough that I can make progress but it is not too onerous to achieve.

I didn’t just want to write, though. I wanted to have the writing be accessible to others. So I figured something like a weekly minimum to publish would be good.

I didn’t really want to have a financial component like the other two challenges. I wanted to see if the motivation of writing for the group would be enough to get people to write. Plus, I didn’t want to have to deal with the hassle of moving money around or setting up a system that was correctly motivational.

Read on →

Ignore URLs and Acroynms While Spell-checking Vim

Today’s post is a short one that I have incorporated into Writing With Vim and will publish when I add a few more changes.

When Vim’s spell check is enabled, words that are not known to be good are highlighted as incorrect. This is the behavior that we want generally. However, there are certain types of text that are commonly marked as incorrect, and it can be tedious or impossible to constantly add them to your dictionary.

One example would be URLs. These are marked as incorrect by Vim by default, but it would be nice to just tell Vim to ignore them from the spell check so you can navigate spelling errors more quickly and to reduce the amount of noise on the screen. You can accomplish this with:

Read on →

Running Old Programs In The Browser

I did my first programming in Applesoft BASIC on the Apple IIc, and then I did quite a bit in middle school and early high school in QBasic on a 486 machine.

I’ve been in a bit of an archival kick lately. I recently started a small project of getting some data off of my Apple IIc disks, which is going well. I thought: maybe there is a way to get my old QBasic programs running as well.

QBasic ran under MS-DOS, the command-line interface of pre-Windows and early Windows computers. You can see a more modern version by typing cmd at the Windows program. I wanted to get a way that I could look at my old programs and to preserve and distribute them to others.

I looked around for a QBasic emulator, and except for the well-known and battle-tested DOSBox DOS emulator, could only find a partially-completed QBasic interpreter written in JavaScript. It didn’t have graphics mode, and many of the programs that I wrote used this.

Read on →

Deciding From Multiple Open-Source Alternatives

In a Slack organization that I am a part of, someone asked:

Has anyone ever heard of anything that takes Github repos and assigns them some sort of “reliability score”? Something that takes stars, commit frequency, PRs, open/closed issue ratio, issue closing time, etc. into account and gives them a score? It would be really nice for choosing between two or three repos that do similar things.

I had some thoughts on this since it is something that I have done in the past, and took them and extended for this post.

Existing alternatives

The Ruby Toolbox tries to give a rough score for ruby gems based on the features above, and it gets most of the way there. It provides a good overview for classes of gems to get a sense of how well maintained they are. Usually when I am trying to find a gem that does something, I start here. Over time you get a sense of a language’s ecosystem and this is less valuable, but it is still useful for finding new gems that might do that thing better.

Read on →