Pragmatism in the real world

Checklist for releasing Slim

Release process for Slim so that I don't forget any steps; based on a check list created by Asgrim. I should probably automate some of this! Preparation: Ensure all merged PRs have been associated to the tag we're about to release.Find them via this search: [is:pr is:closed no:milestone is:merged]. Close the milestone on GitHub. Create a new milestone for the next patch release. Ensure that you have the latest master & that your index is… continue reading.

Auto reloading a PDF on OS X

Currently, I create presentations using rst2pdf and so I regularly have vim open side by side with the Preview app showing the rendered PDF. I use a Makefile to create the PDF from the rst sources, so I just use :make in vim to rebuild the PDF file and then had to switch to Preview in order for it to reload the updated PDF file. Recently a friend wondered why the PDF viewer couldn't reload… continue reading.

API errors are first class citizens

It seems to me that error handling is an afterthought in far too many APIs. When designing an API, I implore you to design your error handling too! The way that your API presents an error is key to a good API; developers integrating with your API will judge you on it. Follow the HTTP rules Just because it's an error doesn't mean that you can forget your HTTP. You need to be a great… continue reading.

Standalone Doctrine Migrations redux

Since, I last wrote about using the Doctrine project's Migrations tool independently of Doctrine's ORM, it's now stable and much easier to get going with. Installation and configuration As with all good PHP tools, we simply use Composer: $ composer require –dev doctrine/migrations This will install the tool and a script is placed into vendor/bin/doctrine-migrations. To configure, we need to add two files to the root of our project: migrations.yml: name: Migrations migrations_namespace: Migrations table_name:… continue reading.

Ctags with Swift

I always seems to end up in vim sooner or later and I use Tim Pope's excellent Effortless Ctags with Git process to keep my ctags file up to date for my projects. As I'm now coding in Swift too, I needed ctags to support Swift. This is what I've added to my .ctags file: –langdef=Swift –langmap=Swift:+.swift –regex-swift=/(var|let)[ \t]+([^:=]+).*$/\2/,variable/ –regex-swift=/func[ \t]+([^\(\)]+)\([^\(\)]*\)/\1/,function/ –regex-swift=/class[ \t]+([^:\{]+).*$/\1/,class/ –regex-swift=/protocol[ \t]+([^:\{]+).*$/\1/,protocol/ Any improvements, welcome! vim.swift As I'm writing about Swift and… continue reading.

Iteration in fixed-everything projects

There are three main variables when setting up a project with a client: price, scope and time. The more flexibility we have here, the easier it is to run an agile project. This is especially true when the scope is not fixed as agile development techniques really start to come into their own. Short development cycles of small, minimal, features allow the client to see the progress of the project earlier and so direct the… continue reading.

Notes on keyboard only use of macOS

It's been a while since I could use a trackpad without pain and even longer since I could use a mouse or trackball. Currently I use a Wacom tablet as my mouse which works really well as long as I don't use it too much. Fortunately, keyboard usage doesn't seem to be a problem (yet?), so I try to use only the keyboard as much as possible on macOS (née OS X). These are some… continue reading.

View an SSL certificate from the command line

I recently had some trouble with verifying an SSL in PHP on a client's server that I couldn't reproduce anywhere else. It eventually turned out that the client's IT department was presenting a different SSL certificate to the one served by the website. To help me diagnose this, I used this command line script to display the SSL certificate: getcert.sh #!/bin/bash echo | openssl s_client -showcerts -servername !$ -connect $1:443 2>/dev/null \ | openssl x509… continue reading.

Cross-platform Makefile for Swift

I'm mostly building Swift applications for deployment to Linux, but sometimes it's easier to build and test directly on OS X rather than spinning up a VM. To facilitate this, I use a Makefile that means that I don't have to remember the compiler switches. It looks like this: # This Makefile assumes that you have swiftenv installed # To get going, start with `make init` SWIFT_VERSION = DEVELOPMENT-SNAPSHOT-2016-05-03-a # OS specific differences UNAME =… continue reading.

View header and body with curl

I recently discovered the -i switch to curl! I have no idea why I didn't know about this before… Curl is one of those tools that every developer should know. It's universal and tends to be available everywhere. When developing APIs, I prefer to use curl to view the output of a request like this: $ curl -v -H "Accept: application/json" https://api.joind.in/ * Trying 178.208.42.30… * Connected to api.joind.in (178.208.42.30) port 443 (#0) * TLS… continue reading.