While I’m spending most of my JavaScript writing time in WebStorm these days, I still use Vim a lot. Over time I’ve found some great plugins, extending Vim to cope with an amazing amount of stuff.

I should note that these are all essentially general purpose plugins. Some of the language-specific ones are great to use, but unless you’re working with that particular language they’re not going to be that useful.

Any screenshots are taken from the plugin website, rather than grabbed by me, unless explicitly noted.

Plug

This is where it all starts. It’s very simple to use — I…


Well — unexpected to me at the time, though part of the language.

Photo by Markus Winkler on Unsplash

I’d been putting something together in Phoenix, and one of the pages kept throwing an error that it couldn’t find item_path/3. This was odd, as the generating code in the template had four arguments.

The same thing happened when I broke into IEx to poke at it:

iex(1)> Routes.page_path(conn, :index, user_id: user.id, item_id: item.id)
** (UndefinedFunctionError) function AppWeb.Router.Helpers.item_path/3 is undefined or private. Did you mean one of:
* item_path/4
* item_path/5

People familiar with Elixir can already spot the problem…

In Elixir, key: value, key: value forms what's known as a keyword list. What I hadn't expected was that those…


Especially coming from a C/Python/Elixir background, there were some things about JavaScript functions that I really didn’t get to start with. I thought I’d write them down in the hope they’ll help someone else on their journey.

I should note this is probably part one — there’s bound to be more things I learn about JavaScript functions as I keep using the language.

When one is async, all are async

I didn’t really understand how JavaScript does async when I started using it, so I spent quite some time trying to work out how a function could get a result from an asynchronous call and return it…


Woman frustrated with her laptop
Woman frustrated with her laptop

I’ve noticed when using tsc in watch mode that sometimes — especially if a file has been renamed — it doesn’t realise the file needs recompiling. This state persists across reboots, restarting the watcher, all the usual stuff.

The last time I hit this was when I needed to re-order the seed files I’m using for this project. A file that had been last needed to be first, everything had to move around as I use numbers in the filenames to ensure the seeding order is clear. Mostly it works really well.

Renaming the files wasn’t a problem, but suddenly…


Recently I’ve been working on integration with a subscription/payment gateway (It hasn’t been straightforward, but that’s a whole other post).

I wanted to be able to test my web-hook code without repeatedly triggering events from the gateway. I stored the incoming events in JSON format, which was fine — but then of course I needed to take the stored events and do something with them.

I thought it might be interesting to make a note of where I started from and how I got to the end. I’ve included the mistakes I made along the way, so if you read…


Title image — typewriter in background with title text overlayed.
Title image — typewriter in background with title text overlayed.

Looking at several different editors

Since I’ve started blogging I’ve naturally needed more from my editors, in terms of both writing and organisation.

For better or worse, blogging and static site systems seem to have settled on Markdown for formatting input. It has the advantage of being fairly simple to learn and using only normal text characters for formatting.

I’ve tried various different editors for writing text — iA Writer, MarkdownPad, StackEdit, and of course Vim/Emacs. Here’s why I’ve settled on Ulysses for my editing.

Ulysses

It has great Markdown support, but more than that:

  • it integrates with multiple blogging platforms…


I had a revelation the other day.

In the beginning…

I was of the idea that to make your UI pretty and reactive, you needed to be using Vue.js, Svelte, or some other web framework. Otherwise, the page just sat there until you clicked a button, and then reloaded. Silly, I know now.

Then I discovered Alpine.js and realized I was completely wrong.


Or, how to use Hapi pre-route handlers

The problem

As I added more methods to my latest project, I realised that there was an increasing amount of wasted effort.

In every endpoint dealing with an item, we had to fetch the item. That also meant that every endpoint also had to deal with checking the user had the right to access that item. When I started adding things belonging to things, and we then had to check the chain of ownership held, it started getting tedious.

I started to think — Express has middleware, I wonder what Hapi has? There’s bound to…


I’ve been lucky enough to discover some good new desktop and coding tools via Medium and dev.to lately. I thought I’d share some of the less common ones I use.

Insomnia

Insomnia is great for testing web APIs. The app is free; the company who make it do also offer paid plans for sharing the requests you’ve defined, useful if you’re in a team.

Image taken from Insomnia website

Postbird

This is a really useful app for connecting to PostgreSQL instances and examining them. It’s able to look at the schemas as well as the contents of the tables, and edit them. …


Example of a DNS lookup resolving to 127.0.0.1
Example of a DNS lookup resolving to 127.0.0.1

The technique we’re using is the one used by Google, Microsoft, and others to verify that you’ve got some authority over a domain. So while it’s not foolproof, at least we’re in good company!

The code in this article is TypeScript, but the same method would work in most languages.

Overview

All of the verification methods I’ve seen for these rely on the user being able to modify the site in some way — which makes sense, since you’re checking if they have control over the site they’re trying to use.

Most of them seem to have settled on using some…

Paul Walker

Software engineer in Bristol, UK. Playing around in my spare time with Nodejs, Typescript, Elixir and Phoenix, Vue and more.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store