I recently migrated from Sidekiq to Solid Queue on a personal project, and generally found the transition to be quite painless. However, at the time of writing, Solid Queue doesn’t support unique jobs, either natively or through a 3rd party gem. (Sidekiq has both, through the popular sidekiq-unique-jobs or via its Enterprise offering.)| Alex Peattie – Engineering leader and former founder, based in Paris
From Rails 7.1 onwards, Kamal 2 is included as a first-class tool for container-based deployments. Kamal aims to make shipping Rails apps to production as painless as possible using Docker. However, before you set things loose on your production servers, it’s often helpful to test your entire deployment flow locally, but deployed to a virtual machine (VM). Unfortunately, I couldn’t find any good documentation on how to do this, even though it turns out to be quite straightforward.| Alex Peattie – Engineering leader and former founder, based in Paris
If you're a developer using macOS you've probably had the experience of double clicking, say, a file in Finder only to inadvertantly launch the wrong application, rather than your editor of choice.| Alex Peattie – Building software and startups, based in London
Deno makes it easy to make client HTTP requests, using the web standard Fetch API.| Alex Peattie – Building software and startups, based in London
While redesigning this site, I ran into an odd problem: my build pipeline was generating CSS source maps but they were somehow getting messed up. Definitions were pointing to incorrect lines, and sometimes the wrong file altogether.| Alex Peattie – Building software and startups, based in London
One of the nice additions in Ruby 2.7 is that IRB by default gets pry-inspired syntax highlighting and multiline editing by default.| Alex Peattie – Building software and startups, based in London
PostCSS is a great tool for enhancing CSS and it has an extensive ecosystem - postcss.parts has a great catalog of available plugins. It also make it quite easy to write your own plugins to extend CSS in weird and wonderful ways. If your plugin is particularly lightweight though, you might not want to bother with the overhead of creating a package, publishing it to NPM etc. Fortunately, it's quite easy to load a PostCSS local plugin inline.| Alex Peattie – Building software and startups, based in London
One of our New Year's resolutions at Peg was to make the site faster. For the most part the site was responsive (requests completed in < 100ms), but certain pages were taking much longer to load than they should - with database queries eating up most of the time.| Alex Peattie – Building software and startups, based in London
One of the most exciting features in the newly released Angular 1.5 is the new helper method (see Todd Motto's excellent, detailed write-up for a full walkthrough). It's now considered best practice to use - a best practice which enofrces. If you don't provide a value for it will default to .| Alex Peattie – Building software and startups, based in London
:::admonition[Update 2020]{kind="update"}As of Ruby 2.2, signing certificates with an EC key is almost identical to a signing with an RSA key: The only difference is that you need to set to rather than (as you'd do with an RSA key).::: Let's Encrypt just rolled out support for ECDSA certificates in staging - a move that I think will nudge ECDSA signing more into the mainstream. ECDSA offers higher levels of security at much lower key sizes;| Alex Peattie – Building software and startups, based in London
Here's a quick Rails question for you. We have a bunch of Posts in a Postgres DB which we want to order by publication day - but Posts published on the same day should be ordered by a different column: upvotes. (This is basically how Product Hunt does it). We're paginating, so we only care about the first 100 posts. How would we do it?| Alex Peattie – Building software and startups, based in London
Happy New Year! First of all I'd like to wish everyone reading a wonderful 2016 😁. New years are traditionally associated with new beginnings - clearing out the clutter of the previous year to start afresh. In that spirit, I'm retiring a couple of my old projects animate-textshadow.js and my CSS floating feedback button tutorial. I won't be actively maintaining them anymore, and they are effectively deprecated - i.e. I wouldn't recommend their use going forward.| Alex Peattie – Building software and startups, based in London
In Devise 3.1+ there's a new way to handle Rails 4's strong parameters. Here's a quick rundown of the change, and how to migrate to the new style. (Background: I wrote the pull request that helped form this feature).| Alex Peattie – Building software and startups, based in London
:::admonition[Update 2020]{kind="update"}This tutorial is out-of-date. See the repository for alexpeattie.com to see how I do it now.:::| Alex Peattie – Building software and startups, based in London
In a recent project, I had to send data between two subdomains on a site. Unfortunately, this meant I had to deal with browsers' same origin policy. The canonical solution to this is to set up Cross-origin resource sharing (CORS) , but this is a bit of a pain to do[^1] - especially if you're only making one or two cross-domain requests - and it isn't supported by some older browsers. Luckily there are some alternatives.| Alex Peattie – Building software and startups, based in London
might be the most useful debugging tool in a front-end coder's arsenal. If you aren't using it, go read Mastering Console Logging to see why its so awesome.| Alex Peattie – Building software and startups, based in London
I wanted to highlight a couple of APIs which I've found very useful, but haven't seemed to have gotten much exposure: SharedCount and RESTMailer. I have no connection to these services, I just think they're great!| Alex Peattie – Building software and startups, based in London
Dry Storeroom No. 1 Earlier this year I read a surprisingly fascinating history of the Natural History Museum in London - Dry Storeroom No. 1: The Secret Life of the Natural History Museum. One of the best stories in the book recounts how an embarrassing mixup involving a cryptogamist (i.e. algae expert) turned into an unexpected triumph:| Alex Peattie – Building software and startups, based in London
TwilioCon Earlier this month, I was fortunate enough to be invited by a client to attend TwilioCon 2012 in San Francisco. I'd had some experience working with Twilio already, but I definitely came away from the conference having learnt a lot.| Alex Peattie – Building software and startups, based in London
There are lots of ways to speed up your Rails site, but here are two I see a lot of sites neglecting: gzipping and serving jQuery by CDN.| Alex Peattie – Building software and startups, based in London
Today I was lucky enough to stumble on this fascinating paper by Nguyen and Sa describing how they created an automated rap lyric generator. It's well worth a read.| Alex Peattie – Building software and startups, based in London
Something I ran into today - the behaviour of jQuery's selector (and its sister selector ) is somewhat unintuitive - at least after version 1.3.2. From the jQuery docs:| Alex Peattie – Building software and startups, based in London
Update 2016: This tutorial is out-of-date. See the repository for alexpeattie.com and the associated README to see how I do it now.| Alex Peattie – Building software and startups, based in London
My project for February was a redesign of the site. As well as overhauling the look of the site, I revamped the site's internals -- migrating the site from Jekyll to Middleman.| Alex Peattie – Building software and startups, based in London
This post is inspired by a question I answered on StackOverflow a while back, asking about the best way to define the version of a Ruby gem.| Alex Peattie – Building software and startups, based in London
Just a simple tip that you might not be aware of - if you have an empty, anonymous function in your code like this:| Alex Peattie – Building software and startups, based in London
animate-textshadow and Pure CSS floating feedback button It's been a while since I blogged last. Since then, lots has happened in the tech world: we had the S3 apocalypse, the PSN debacle, Microsoft bought Skype, the world bought LinkedIn shares. I've been keeping myself equally busy, and I'm going to be rolling out a bunch of new coolness over the next few weeks.| Alex Peattie – Building software and startups, based in London
Dropbox, Quora, Pinboard and Ping Last month I released the JustVector Social Icon pack, 100 monochrome vectors for social sites and services. Really, the pack was a selfish endeavour: although there are plenty of social icon packs out there, what I wanted - no frills, full-scaleable vectors for all common sites - was difficult to find. But the feedback I've gotten suggests others have found the icons useful too, and the pack's already clocked up 10K+ downloads.| Alex Peattie – Building software and startups, based in London
A few weeks ago, I became interested in whether there was a strategy to always “win” Wordle (i.e. to find the secret word in 6 guesses or fewer). This is exactly the problem that Laurent Poirrier examines in his excellent writeup on applying mathematical optimization techniques to Wordle:| Alex Peattie – Building software and startups, based in London
When working in git, you most commonly trace a repository's history using commits' SHA-1 hashes. To revert to a previous commit, you might write something like this:| Alex Peattie – Building software and startups, based in London