Handling GET remote forms with Turbolinks in Rails 6

In response to this problem with Turbolinks. import Turbolinks from ‘turbolinks’; document.addEventListener(‘turbolinks:load’, function(event) { for (let form of document.querySelectorAll(‘form[method=get][remote=true]’)) { form.addEventListener(‘ajax:beforeSend’, function (event) { const detail = event.detail, xhr = detail[0], options = detail[1]; Turbolinks.visit(options.url); event.preventDefault(); }); } });

Using 'aria-labelledby' as a styling hook

A couple of months ago, I was greatly inspired by an article on Smashing Magazine entitled Semantic CSS With Intelligent Selectors by Heydon Pickering. It goes into depth on how aria roles can be used as hooks for button styling among other things. After using some of Heydon’s techniques, I got thinking about how they […]

OSX Terminal – Tab and window shortcuts

In a previous post, I shared a tip on Naming your Terminal tabs in OSX Lion. I’ve been meaning to share some additional shortcuts that I use day-to-day for opening new tabs and renaming them via the command line. The workflow We can rename tabs and windows as before: # Rename tab tabname “Funky Tab” […]

Git add -A and git commit one liner

When working with Git, I often find myself typing: git add -A && git commit -m “My commit message” This stages any changes including new files (which “git commit -am” doesn’t), marks any files that have been deleted from the working copy as removed and commits to the repository. Following a quick Google search, and […]

Quickly pushing your public SSH key to a server

I find myself needing to do this on a regular basis, so here’s a handy snippet for adding your public SSH key to a server’s authorized_keys file, assuming your public key is at “~/.ssh/id_rsa.pub” (the default). ssh user@host “echo ‘`cat ~/.ssh/id_rsa.pub`’ >> ~/.ssh/authorized_keys” …or pop this in your ~/.profile file: function push-key { ssh $1 […]

Announcing Tache – Just enough Mustache for end users

I’ve finally found some time (thanks to the xmas break) to have a crack at a ‘safe’ Mustache implementation in Ruby. By this, I mean an implementation that allows for templates to be edited by end users without fear of jeopardising an app’s security. This is useful in many situations, for example in a CMS […]

Embracing perfectionism as a long term goal

I’ve suffered for a long time with a condition known as perfectionism. It’s a debilitating disorder that hampers productivity through a constant pursuit of idealism. There are many problems that come with being a perfectionist. Firstly, there is the aforementioned productivity impairment. But also, it’s hard to be happy with anything you produce or anything […]

A few notes on Responsive Design

I’ve been working on a few responsive design projects recently and an old friend of mine asked what I had leaned on my journey, below is my response (pardon the pun): Basically, it’s seen as bad practice to target specific devices, instead you should just target the breakpoints that make sense i.e. scale the browser […]