Ruby for non-Rubyists with Snap

I'm an Ubuntu user and I enjoy most server-side scripting languages but I haven't done much Ruby and I never get the feeling that Ruby is pleased to see me when I do. Something is always out of date or has an incompatible dependency or ... and since I don't use it regularly, I don't have the familiarity that enables me to easily debug these things with other platforms.

I've been using the Ruby Snap on Ubuntu for a while now, and I think it's a bit better? I've referred to my notes every time I've done it though so I thought I had better put them somewhere I'll find them even when I'm using a new notebook :)

What versions are available?

snap info ruby will show your choices of versions to install. I usually just need a major.minor version combination so I set the version with:

sudo snap switch ruby --channel=2.5/stable
sudo snap refresh

If you see a lot of "extension not built" anger then try this: ruby.gem pristine --extensions

Using Ruby and Gem and Bundle

The snap actually ships with all these commands available as separate commands:

  • ruby (just check this is the right one! Should be the same as /snap/bin/ruby - if it's not check what order things are in your $PATH)
  • ruby.gem is the gem executable for this snap ruby
  • ruby.bundle is the bundler gem for this snap ruby (I use this one the most since my ruby usage is basically bundle exec jekyll serve most of the time!)

Beware that the 2.5 channel has bundler v2 and the 2.6 channel has v1, I have no idea why but it's tripped me up at least four times now

Sniglet is a Font for Avoiding Font Loading Mistakes

I am not a designer, nor will I ever be. Things look perfectly fine to me a very long time before they look OK to anyone else! Along with that, I don't always find it easy to tell fonts apart. I can do serif-ish and sans-ish but if the fixed-width font has serifs on it I sometimes miss that detail if I'm not looking for it - which also means that I have no idea if I've loaded the fonts I was thinking of or not.

To get around this, I test everything by switching the font to Sniglet from the League of Moveable Type. It's ... umistakable! Continue reading

OpenAPI Description using API key and secret

I've been working on a few OpenAPI descriptions of APIs lately, and really enjoying the benefits they bring. In particular the ability to import into Postman as a collection I think is a "killer feature" for APIs looking to get developers up and running quickly. The catch? I found that an API that needs an API key and secret, or a username and password/token, is supposed to be described with multiple security schemes - but this does not play nicely with tools like Postman. Continue reading

The Laravel Synchronous Queue

Using queues for asynchronous processing is one of my favourite tricks for offloading hard work from web servers. When working with Laravel recently I was pleased to find that it supports beanstalkd out of the box. I've got opinions about frameworks with Opinions but I did find one thing I really liked in the way Laravel uses queues: the sync queue option that runs your queue synchronously on your development platform so you can develop and debug your work, then switch the queue platform you use later. Continue reading

Handy Beanstalkd Admin Console

I've been building apps with queues lately and mostly using beanstalkd as my queue because it is very simple, very fast and on my platform it is [apt install beanstalkd] -easy to install. I have also been using a handy web interface for beanstalkd which I like so much that I felt I ought to share! It's beanstalk-console, which is a PHP-based web interface to one (or many) beanstalkd servers. Continue reading

HTTP Toolbox

As Web Developers, we need to know how to work with HTTP from every angle. I gave a 2-hour tutorial at PHP UK that included some of my most trusted tools - but it was sold out and a bunch of people asked me if there was video (there wasn't, tutorials make little sense when videoed). Instead, I thought I'd try to set out a self-study version of the workshop (I rarely teach these days so I'm unlikely to deliver it anywhere else).

There's a slide deck, some exercises and a sample repo on GitHub ... let's dive in! Continue reading

Using Tags in your OpenAPI Spec

Working with OpenAPI is bringing so many possibilities to the way that developers work with APIs, it's exciting! The spec is very comprehensive though and I've found myself answering questions on individual aspects of it recently, so I thought I'd capture one or two of those things here. Today: tags. Continue reading

Windows removed my grub menu

I know this will happen to me again at a bad moment so I'm putting it here on my blog and hoping I can find it in my future hour of need ...

My work machine is a Windows PC, with dual boot to the Ubuntu partition that I actually use. Sometimes, when booting Windows, it "repairs" its disks and removes my grub menu, booting straight into Windows without showing me the grub menu.

To fix this: interrupt the startup, choose the boot device and pick the Ubuntu partition from the list.

Once booted, you can boot-repair to sort out grub - I also travel with a boot disk, just in case!

Ready-to-wear API Collections with OpenAPI and Postman

Have you noticed that API providers are starting to offer "descriptions" of their APIs? These are usually OpenAPI specifications, computer-readable documents that describe every aspect of an API's endpoints. They can be used to generate documentation, SDKs, but now they can also be used for my favourite API-related activity: poking around! Postman just added a feature to allow importing OpenAPIs and I love it. Continue reading