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...
This morning I learned about the hidden attribute that can be added to <option> tags within a <select> tag. The hidden attribute causes the option to simply not be shown in the list. Hidden elements will are also not selectable and will not return any selected value. The hidden attribute works in most browsers, with ~97.5% of browsers supported. For...
It’s been a while since I’ve worked with transactional email directly with Rails. This is because I’ve previously been working on some larger projects that have justified the use of an external mailing system like Mandrill, where email templates were used to generate email within that system, and sending an email from the Rails app was just an API call....
Yesterday I learned about toLocaleString, a Javascript function defined on the Number prototype since ECMAScript 3. It has had a couple of iterations of arguments, but the version supported by most browsers provides a very convenient API for formatting currency in a user’s locale: Examples: Note: Wherever I have passed undefined as the first argument to toLocaleString, this simply means...