How to set up SES on AWS so you can send emails from Rails cheaply in production

May 19 2015

Sending emails from Rails is not that hard, but keeping them out of user's spam folders can be difficult. The first time I set up a production rails app as an MVP for a project, a significant number of users didn't complete sign up because the account confirmation email went straight to their spam folder. There are a lot of reasons this can happen, and a fair number of tool online that will tell you what they are. Fixing the issues often involves sending mail through a delivery partner so that...

How to add tests to legacy code so you can understand it quickly and start making changes with confidence

May 18 2015

Taking over legacy code can be challenging. There are a whole load of issues to deal with, ranging from understanding what on earth it's supposed to be doing, to fixing massive problems with the underlying architecture. So where to start and how can you make your life easier?

What I've learned after being in this position many times is that the most important thing to do right from the start is to work on the tests. Doing this helps for several reasons, and not just the obvious ones. Normally...

How to make code snippets in your middleman blog look beautiful using highlight.js

May 6 2015

I started to blog with Middleman recently (this blog you're looking at is the result) and found that getting code blocks to embed and display cleanly was a bit of a pain. I tried a few different approaches which I wasn't happy with, before settling on the one you can see here, which I'm really pleased with. This post will explain how I did it and provide you with code you can use to achieve the same thing.

TBH, most of this is not specific to Middleman and may well be useful for other platforms...

How to get ideas for a gem, when you don't know what to make

May 5 2015

Ruby is currently (and will likely remain) my favourite ever coding language, so I really want to get to know every part of it as well as I can. This has given me an itch to learn how to create and publish gems for quite a while, so recently I decided to give it a try. I've gained a lot from the enormous array of community-written gems that people have made available, so becoming part of the community and contributing something back felt like a worthy thing to aspire to.

However, when I sat down...

How to refactor Moodle code so that it's easy to understand and maintain using the composed method pattern

Apr 15 2015

Having used Moodle for many years, I've found that the code can sometimes be a bit unwieldy in places and can be rather confusing to read (including my own!). This isn't a lot of fun. Thankfully, there are many techniques for refactoring code in order to make it more readable and maintainable. This post will outline the composed method pattern, which is one of my favourites, and show you how you can use it. We'll be taking part of a bloated class that's doing too much and refactoring it into an...