Writing high-quality git commit messages is one of the most responsible things you can do as a developer who cares to write considerate code that is well thought-out and easy to maintain. There’s a great template for git commit messages that’s floating around in a number of places. It’s referred to the “Contributing to a Project” chapter of the Git...
Recognizing or validating URIs in a string or strings of text is a fairly common problem. Unfortunately, just as common is the range of regular expressions that exist to validate URIs (or, generally, URLs). There are many, many StackOverflow answers and blog posts that lay out a massive variant of expressions in function and quality, and it’s not the easist...
Today, while working on consuming a third-party API, I discovered that the result of a begin/rescue/end block in Ruby can assign to a variable, just like an if statement can. This isn’t a technique I’d recommend for every single situation where it could be used, but it is convenient for operations where a particular error scenario can result in a...
Tonight I had a need to create a duplicate of a running app on Heroku, and discovered heroku-fork. This is a plugin which was extracted from the core Heroku CLI some time ago, but is easily installable using the command heroku plugins:install heroku-fork. It is run via: heroku fork --from [app name] --to [app name, can be new app] The...
Continuing my transformation of my development environment to match Wes Bos’, today I discovered from a Stack Overflow answer how to change how comments in any language are rendered in VS Code. It turns out that there is a setting to control it, it’s just deeply nested. The necessary snippet for user settings is: "editor.tokenColorCustomizations": { "textMateRules": [ { "scope":...
I’m working through Wes Bos’ ES6 for Everyone, and he’s dropped yet another useful tip for me to build into my day-to-day work - console.table. console.table supports both objects and arrays, displaying data in a table format that is much easier to read than simply logging the data: console.table(user) console.table(repos) To restrict which columns are shown for a collection of...
Occasionally, a particular bug or customer query will necessitate jumping into a Rails console connected to a live database, or a copy of the live database, that we wish to read from, but not change. I was reminded today of an option that can be passed to the rails console command, -s, or --sandbox. This wraps the entire console command...
My tech education has been almost exclusively Wes Bos based at the moment - I’ve finished React for Beginners, am halfway through his ES6 course, have Redux queued up, and am keeping an eye on his progress with his advanced React course. I’m also a listener of the podcast he produces along with Scott Tolinski, Syntax. As a short break...
Today I had to debug a library to try and determine why a particular HTTP request was failing. The problem was, this particular library uses Net::HTTP, without any particular hooks to customise how the request will be executed. I discovered the following handy code snippet at https://gist.github.com/ahoward/736721, which forces debug output to be on for any instance of Net::HTTP created....
Cherry-picking git commits isn’t part of my day-to-day workflow, but I do need to do it occasionally. Generally, and in the case I ran into today, I had a range of commits that required cherry-picking from master onto a long-lived feature branch. Normally cherry-picking in git will take each commit and “copy” it onto the current branch. This is generally...