Pragmatism in the real world

My JetBrains IDE shortcuts

In the JetBrains IDEs, the "Default for macOS" keymap isn't doesn't feel very Mac-like to me, especially for keyboard navigation in particular. Apple provides details of the keyboard shortcuts you can expect to work in a Mac application, so these are the changes that I've made to make PhpStorm and PyCharm feel more at home on my Mac: Open Preferences and select Keymap from the left hand side. Then select "Default for macOS", click the… continue reading.

Dark and light mode blog images with MarsEdit

As dark mode is more popular than ever now that the iPhone supports it, I've been working out how to get the browser to render a dark image in dark mode and a light image in light mode. It turns out that the way to do this simply is to use the <picture> element like this: <picture> <source srcset="/wp-content/uploads/2019/11/example-image-dark.png" media="(prefers-color-scheme: dark)" /> <source srcset="/wp-content/uploads/2019/11/example-image-light.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" /> <img src="/wp-content/uploads/2019/11/example-image-light.png" alt="Description of example image… continue reading.

First steps with Windows on Vagrant

One thing that would be useful for one of my projects is an easy way to install IIS, PHP & SQL Server on Windows in a repeatable way. I wasn't sure how to do this until I came across Chocolatey and Boxstarter. Chocolatey is a package manager for Windows along the same lines as yum and apt for Linux and knows how to install a remarkable amount of software. Boxstarter is a way to automate… continue reading.

Using a separate master password in 1Password for Mac

I really like the 1Password password manager and recently switched to using the subscription based account. This allows access to my passwords via the web so, as you can imagine, I have a very strong 35 character master password set. On my Mac, I use the 1Password app and that requires me to enter my master password reasonably frequently, so this very long password is not so desirable here. I'm comfortable that a 12 character… continue reading.

Keyboard shortcut to Save as PDF on Mac

I regularly print to PDF on my Mac, This is done from the print dialog by selecting Save as PDF from the drop down in the bottom left of the dialog which is a bit of a pain to get using the mouse. I recently discovered that I could create a keyboard shortcut to make this much easier. In System Preferences -> Keyboard -> Shortcuts -> App Shortcuts you can create a keyboard shortcut to… continue reading.

Keyboard control of macOS notification alerts

I use Apple's Reminders app to remind me about things that I need to do. It has the useful feature of syncing across my Mac, iPad and iPhone and I can add to it via Siri in my car. When I am notified on my Mac, a notification alert appears with two buttons: Complete and Later. Clicking Later offers a set of options to dismiss the alert and have it reappear in 5 minutes, in… continue reading.

Autojump is magic

One of my favourite command line utilities is autojump. It's a small command line utility that allows you to change directory without having to remember exactly where that directory is. For example, to start working on OpenWhisk, I simply type: j openw And the current directory is changed to /Users/rob/Projects/openwhisk/incuator-openwhisk for me. This is much easier than typing cd ~/Pro{tab}op{tab}in{return}! Biasing towards a particular directory When you have a directory that's a common one that… continue reading.

Using .vimrc for project specific settings

I'm more of a spaces person than a tabs person when it comes to source code and in Vim, I like to see the tab characters, so I have this setting: set listchars=tab:\⇥\ ,trail:·,extends:>,precedes:<,nbsp:+ This places a handy ⇥ character so that I can see the tabs: I'm currently working on a codebase where the coding style is to use tabs, so I need to change my settings. One option is to use EditorConfig, for… continue reading.

Run the UniFi Controller headless on Mac

I'm running a UniFi network here with wireless access points, the Security Gateway and a PoE switch. It seems to be a robust system and is almost certainly overkill, but reliability is high on my lists after bad experiences with a NetGear WiFi router. The UniFi system software is called the Controller and runs on a various operating systems. As I have a Mac mini here, I decided to run it on there. Weirdly, however… continue reading.

Using ngrok to test on a mobile

To test a website that you're developing on your local computer on a mobile device such as a phone or tablet use ngrok. This is the way to do it: Start up ngrok: $ ngrok http my-dev-site.local:80 This will start up ngrok and give you a "Forwarding" URL such as http://24f55bf5.ngrok.io. In this case, it will direct all traffic to that URL to http://my-dev-site.local. If you run your website on a different port, such as… continue reading.