footnotes-highlight#highlightFootnote"> 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 .) The good news is that…
footnotes-highlight#highlightFootnote"> 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).…
footnotes-highlight#highlightFootnote"> 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: Is there a strategy that guarantees to find any one of the 12972…
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.
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.
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…
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.
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 .
:::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…
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?
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…
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).
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…
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.
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!
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:
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.
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.
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:
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. A few people have asked me how I do the Github-style syntax highlighting on this site. Here’s an example Ruby script with highlighting: class A < B ; def self.create ( object = User ) object end end class Zebra ; def inspect ; "X #{ 2 + self. object_id } " end…
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.
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.
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…
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: