Chris Worfolk's Blog


How I optimised Leeds Anxiety Clinic

October 29th, 2018 | Tech

We’re taking the lean startup approach with Leeds Anxiety Clinic and trying not to build anything unless we absolutely need it. As a result, when I originally built our website is was functional but not particularly fast.

Now that we’re up and running and have clients coming through the door, I’ve been back over the site to make it faster and better. Below, I’ve detailed what I’ve done. Here’s a before and after using the Lighthouse audit tool:

Turn cache headers on

There were no cache headers on our images, CSS or JavaScript. Part of this was that I was still making changes to the JavaScript and didn’t have any cache-busting functionality in the site yet. Now that I do, I could safely let the browser cache everything for a month.

Replacing jQuery

jQuery is a library whose time has been and gone. But it does make it super easy to throw in some functionality. Now that I have a proper JavaScript setup, however, and as jQuery was mostly just animating things, I replaced it with native CSS animations and vanilla JS.

Compressing the JavaScript

As there was no JavaScript preprocessing going on, it was not compressed. Ironically, this hasn’t made it any smaller because I’ve now got the Webpack bootstrapping in the file. However, it does mean I can easily load in additional modules, which I discuss below, to help with other areas of the site.

Gzip compression

This is a super-easy win because all you have to do is put it in your Apache config and the server does all of the rest.

Async loading of web fonts

We had a total of three blocking font calls in the header of the page. All of this has now gone. I’m using webfontloader to load in the two variations of Lato that we are using.

Fontawesome is used for icons and is loaded in using a classic link tag, however, I’ve moved this link tag to the bottom of the page so that the initial content can be loaded first. On slow connections, this means the icons are missing for a fraction of a second when you load the page but I think it is worth it.

If I was looking to optimise further like I do with Worfolk Anxiety, I would select the individual icons I want, base64 encode them and put them directly in the CSS. But that seems overkill here for the moment.

Finally, I’ve set the font-display CSS property to fallback so that if the fonts are slow in loading, the text will be rendered away using a system font.

Webp images

Oh my god, webp images are so good. They’re like half the size of the already optimised JPEGs and PNGs that they are replacing.

Unfortunately, few browsers support them yet. It’s basically just Chrome (on desktop and Android). So, I’m using the picture tag with a fallback, as everyone does. I can’t wait until webp gets wider adoption.

Unfortunately, there is no way to do a safe fallback in CSS so my background images remain old JPEGs for everyone.

ROKA shipping posts

October 28th, 2018 | Life

These are the ROKA SL-1 sunglasses. They look pretty nice:

Here it is listed on their website for approximately £95 (at time of writing the dollar is trading at 0.76 to the pound).

But what happens if you try and buy the sunglasses in the UK? Suddenly they are £165.

That appears to be £18 in mysterious currency difference, £25 delivery and £28 in taxes. Although to be fair, I can reduce the delivery cost by £2 if I select “import charges collected upon delivery” with no indication as to how much these might be.

Is this what everything we buy is going to be like after Brexit?

National Railway Museum

October 27th, 2018 | Life

Here’s a possibly controversial opinion. The Nation Railway Museum: not that good? I mean, it’s pretty good, and it’s free, but it’s not as amazing as I imagined it would be.

In fairness, the nature of my visit didn’t help the matter. I went there to meet Elina and Venla after the Yorkshire Marathon and so headed straight to the Great Hall where they were located. In some ways, this is the centrepiece of the museum. But in other ways, it is the most boring.

They have a bunch of trains. But you can’t go in them. I mean, they’re trains. They’re designed to have people in them. It’s not like they’re the Mona Lisa: they were built for people to go inside.

Or, at very least, allow us to look in them. Bus most didn’t even had steps up so you could take a peak, and even when they did, they only slowed you the ends of the trains, rather than a proper walkway. Without them, it’s just not that good because trains are really tall.

I thought the station hall was a lot better. This is set up like a train station so you can see into each of the carriages and you can go into several of them, too. The postal train was really interesting.

More importantly, Venla had a good day. If you gave her a giant hall where she could run around in, she would have a briliant time with that alone. Being able to scream “choo choo train” every minute for several hours was just an added bonus.

Super fast half marathon

October 26th, 2018 | Sport

I did my full-length training run for the Yorkshire Marathon three weeks before the race and shortly after came down with a cold, meaning I had to cut short my final long training run.

A week out from the race and I was still feeling rough. However, I decided I needed to get at least 30km in my legs, so having done Parkrun I set out to do 20km on the Sunday.

Despite feeling crap, it didn’t hold back my pace. In fact, I was faster. My current PB is 1:52:24, which I set at the Canal Canter in March. I topped the distance up to a half marathon and ran a 1:45:25 – almost seven minutes faster than my PB and representing a pace of 4:58 per kilometre.

How? I don’t know. Chris hypothesised that my body’s natural pain management from the cold was still in effect. There may be something in that as it didn’t hurt that much. It certainly will be interesting to see what I can do in a race.

Vegan cookbooks

October 25th, 2018 | Food

I’ve been working through a few of Aine Carlin’s cookbooks that Sarann kindly lent me. They’re not doing it for me, to be honest. They’re not filled with recipes, and many of them just didn’t take my interest or were based around ingredients I couldn’t use. But there were a few nice dishes.

Aduki bean casserole from The New Vegan

Shepherd’s pie with sweet potato mash topping.

Cannellini bean stew.

Yorkshire Marathon photos

October 24th, 2018 | Photos, Sport

As it was my first marathon event, I decided to splash the cash on the official photos.

This one is near the start. You go from the university, into town via the Minster, and then out into the countryside. So, at this point, I’m feeling okay.

Read the rest of this entry »

Slow Cook Book

October 23rd, 2018 | Books, Food

The Slow Cook Book is a cookbook by Heather Whinney. It contains hundreds of recipes and all of them come with instructions for how to do it in a slow cooker, or using a more traditional method. This feature is great when you forget to put your slow cooker on and need to cook your dinner in a lot less time.

Some of the recipes are a little involved: there is 15-20 minutes of prep and pre-cooking in a pan before you put it into the cooker. However, once you get used to this and plan for it, it’s not too much hassle and comes in a predictable format.

The recipes are tasty. However, as is a problem with most slow cooker recipes, they tend to be very liquidy. And there is a lot of them. We’ve been doing one a week for probably over a year and still haven’t got the end.

Armley Parkrun

October 22nd, 2018 | Sport

Earlier this month I went up to Armley to do the Parkrun there. It’s about three kilometres away from the city centre, so just a little further than Woodhouse Moor.

Armley Parkrun launched over the summer, albeit with a “soft launch”. When I mentioned it on my blog I volunteer contacted me and asked me to remove the reference and when I asked about it in running club everyone spoke in hushed tones. Apparently, when a new Parkrun launches there is an unwritten rule about not telling anyone. It’s one of the weird rules that makes me a little uncomfortable at how Parkrun operates as an organisation.

Nevertheless, having been running for over four months, it is now a well established and welcoming run. They seem to have an army of volunteers, based on the sample size of one event.

The course is a mix of tarmac and grass. Having run past Gotts Park many times I assumed the course would be very hilly. However, Armley Park itself is really flat: probably flatter than Woodhouse Moor. It’s three loops with a bit of a crossover between the start and finish. It seems a good option to go for if you’re looking for a PB.

Ironman World Championship 2018

October 21st, 2018 | Distractions, Sport

A full distance triathlon consists of a 3.8km swim, 180km bike and marathon run to finish the race. Ironman is the most famous of the full distance brands, and every year people compete in Ironman races around the world to earn a qualifying spot at the original race in Kona, Hawaii.

I watched it for the first time last year. Patrick Lange took his first victory and set a new course record of 8:01:40 after Cameron Wurf set a new record on the bike course. Meanwhile, in the women’s race, Brit Lucy Charles led for the swim and most of the bike until Daniela Ryf came storming through to take the lead and run her way to a third victory in a row.

This year they were celebrating the 40th anniversary of Ironman and they did so in style: the weather was absolutely perfect. Or, at least, as perfect as you can get on a lava field on a tropical island.

Josh Amburger led out a fairly easy swim for the elite men, coming home in 47:39. You might think that was the fastest swim of the day. But no. Age group athlete Jan Sibbersen smashed the age-group record with a swim of 46:29 while Lucy Charles went on a solo charge and broke the elite women’s record with a time of 48:14.

Things didn’t slow down on the bike. Cameron Wurf, who set a new course record last year with 4:12:54, brought it home in 4:09:06, breaking his own record by nearly four minutes.

Lucy Charles ploughed on on the bike. However, Danielle Ryf was simply unstoppable. After an awful swim due to being stung by a jellyfish and almost pulling out of the race, she finished the bike course in 4:26:07, smashing the women’s record, taking nearly 30 minutes off her time from last year (4:53:10).

Once onto the run, defending champion Patrick Lange finished the marathon in 2:39:58, becoming the first person ever to go sub-eight hours in Kona with a total time of 7:52:39, beating his own course record from last year by nine minutes. Second place Bart Aernouts also finished under eight hours while Britain’s David Mcnamee took the third podium stop for the second year in a row. Other notable finishers included Joe Skipper in 7th (Ironman UK winner) and Tim Don making his return to Kona.

On the women’s side, Daniella Ryf smashed the course record with a time of 8:26:18, giving her her fourth world championship in a row. Lucy Charles made it two for two on the second spot of the podium with Germany’s Anne Haug in third after running the fastest marathon time in the elite women (2:55:20). Four female athletes went under three hours in the marathon and ten went under nine hours.

And to finish it all, Patrick Lange celebrated by proposing to his girlfriend on the finish line. She accepted. He said something about “if I set a course record”, so lucky for her that it was a fast day, I guess!

Venla’s second birthday

October 20th, 2018 | Family & Parenting

It’s easy to believe that Venla is two years old already because who can really remember a time when she wasn’t around. It was a golden age where we did what we wanted and slept without interruption.

We did a little party for her on the weekend before and I think there was a ratio of 1:1 on cakes to guests. Which worked out very well for everyone involved.

We also took her out for ice cream on her actual birthday; just the three of us. Unfortunately, Kaspa’s offered their usual terrible service and forgot about Venla’s ice cream, so she threw a tantrum. The terrible twos have arrived in style.