Chris Worfolk's Blog


Autoprefixer

June 4th, 2016 | Programming

html-code

Web browsers come in various shapes and sizes: different users will have different ones, and inevitably different versions of the same one. When CSS3 arrived browsers began adding support for it before the specification had been finalised and so used vendor prefixes.

The result, now we have a standardised CSS3, is that some users have proper CSS3 support and some have the support, but only behind a complicated series of vendor names. Therefore, if you want to use flexbox for example, you cannot just rely on display: fiex; as for some users it will only work with the appropriate vendor prefix.

This means you have to tediously insert all of these vendor prefix statements to get cross-browser compatibility. However, there is a tool called Autoprefixer that takes this hassle away. It is an NPM module that converts your regular CSS into CSS with vendor prefixes. You write:

display: flex;

And you get:

display: -webkit-flex;
display: -ms-flexbox;
display: flex;

This means you have to compile your CSS. However, if you are already compiling from LESS or SASS, it’s really easy to integrate it. On one of my current projects I already had Gulp compiling SASS, so it was one-liner to add the step in. SitePoint have a tutorial on how to set it up.

Harrogate pubs

June 3rd, 2016 | Friends

A few years ago, while I was working up in Harrogate, my friend Alan and I refined the art of pub lunch. At Buzz, Jason and I achieved pub week, which was no mean feet. However, we could only dream of the system Alan and I put in place. Sometimes with other colleagues, sometimes not, we got it down to a schedule.

Day Pub Notes
Monday Smiths Arms Nice way to start the week. Food was okay. Mostly, it was close.
Tuesday Squinting Cat Quiet, plenty of tables, big range of food and the barman was a character.
Wednesday Black Swan, Fat Badger Usally Black Swan, but occasionally we would drive into the centre for the Fat Badger.
Thursday Old Spring Well, Pine Martin Good specials, though roadworks severely hampered our journey times, in which case we would fall back to the Pine Martin.
Friday Square & Compass Bit of a drive to North Rigton, but worth it for the food.

This went on for months. We managed two team lunches in my current team this week. That was great, but I can only dream of the glory days…

old-spring-well

Mary Berry’s Absolute Favourites

June 2nd, 2016 | Books, Food

Absolute Favourites is 2015 cookbook by Mary Berry. It ties in to a TV show that I haven’t seen.

One of the things that Elina always comments on is how practical Mary is, especially in comparison to Paul Hollywood. Hollywood will insists on all kinds of different kitchen implements, whereas Mary will usually find a way to re-use the same bowl. This shines through in the book. Most of the recipes have a “you can do this bit in advance” or “make this and freeze it for later” section.

I was very much amused by comments such as “teenagers will love this”. It is organised by meal time and does classic dishes: steak with peppercorn sauce, meatballs in tomato sauce, fish pie. It still feels contemporary though: chilli burgers, sticky chicken and tapas all put in an appearance. The dishes are easy to make too.

Where perhaps it falls down in our kitchen is that perhaps the quintessentially English dishes are just a little bit boring. I felt like I was going easy on myself when I picked one of these up. The food does not suffer because of it though: everything we did was reasonably tasty or better.

My two favourite dishes were the lentil shepherd’s pie, a great alternative if you want to cut down on your meat intake, and the fish pie (shown below).

fish-pie

This is a super recipe that uses chunks of bread as croutons that you sit on top and toast slightly, revealing a sea of fish pie underneath.

This isn’t the most adventurous cookbook I have had but it has a lot going for it: the recipes are simple, easy to get right, have scope for pre-paring many of them and produce lovely results. Well worth investing in if you want to cook some English.

mary-berry-absolute-favourites

Warehouse of Gifts

June 1st, 2016 | Public Speaking, Video

Two days after I delivered Speak from the Heart at Leeds City, I delivered a speech called “Warehouse of Gifts” at Asselby Speakers. It was another speech I had written to try and develop my personal stories and improve the emotion in my speeches.

I did not go there with high hopes. The speech was rough, the idea was clichéd, and I was doing the whole thing in a Finland hockey jersey. However, it actually went a lot better than the other one did. People liked it.

Asselby Speakers is a great place to take a speech. It is an advanced club, only open to Competent Communicators. The result is that you get unparalleled feedback. Speeches that regular clubs fail to give any suggestions, Asselby will give you an A4 page full, which is what you want at this level.

Speak from the Heart

May 31st, 2016 | Public Speaking, Video

Recently, I’ve been working on including more personal stories and emotion in my speeches. Some have gone better than others. This speech, for example, was a failure. Sort of.

Feedback was very positive. One of our members stopped me in the bathroom to tell me that he had never written a feedback slip before, but had tonight, because my speech was “perfect”. In fact, all the feedback slips were positive, which is frustrating because you can’t improve when nobody call tell you what was wrong. This was extra frustrating, because I failed to win best speaker.

Looking back at the video though, I can see why it wasn’t a winner. It doesn’t have the emotion in that I wanted it to have. I just didn’t express it. In fact, I think my trademark humour, as everyone refers to it, probably detracted from the speech because it took the edge off the emotion, and maybe I shouldn’t have done that.

Travis CI

May 30th, 2016 | Programming, Tech

travis-ci

Travis CI is a cloud-based continuous integration tool. Notably, it is also free for open source projects. They do paid subscriptions as well if there is a private repo you want to test. If you just want to test a public GitHub project though, it’s free and really easy to set up.

You can log in with your GitHub account. Once you have done this, you are given a list of your projects and you can turn on Travis CI for each one individually. Using the GitHub hook, you can configure Travis CI to automatically run a build every time code is pushed to the repo.

It supports an array of different languages and platforms. To get up-and-running, you need to add a config file into your repo. This is pretty simple. Here one I am using for a PHP project:

language: php

php:
– ‘5.5’
– ‘5.6’
– ‘7.0’

install: composer install

This configures it to run it on three different versions of PHP, and install the dependencies before starting the test. It comes with many of the common PHP extensions already enabled, and an additional list of ones you can enable if you need them.

Badge Poser

May 29th, 2016 | Programming

badge-poser

Badge Poser is an online tool that generates badges your PHP projects’ readmes. There is zero setup: it integrates with Packagist, so once you have your package setup you simply go to the website, enter your package name, and it generates the badges for you.

It then generates a series of Markdown for you to insert into your readme. This will then display anywhere where your readme is rendered: GitHub and Packagist for example.

Currently, it can generate badges for:

  • Stable and dev branch names
  • Total downloads
  • Monthly and daily downloads
  • License

Can Britain win Eurovision?

May 28th, 2016 | Distractions, Thoughts

eurovision-2016-winnerJamala wins Eurovision 2016. Photo credit: Thomas Hanses (EBU).

This will be the last post about Eurovision for a while. I promise. Probably. I want to address this issue though because a lot of people think Eurovision is a joke and there is no point us trying because we can never win. This isn’t the case.

We’re really good at Eurovision

Britain’s recent performances in Eurovision are not indicative of our past performance. A look at the all-time winners list puts it in perspective.

Country Wins
Ireland 7
Sweden 6
United Kingdom 5

We are the third most successful country in Eurovision ever. It’s only Sweden’s two recent victories of Loreen in 2012 and MÃ¥ns Zelmerlöw last year that have pushed them ahead of us. The UK and Ireland between them have cleaned up. We’ve also hosted it a record number of times as we have helped out poorer countries by hosting it for them on several occasions.

Good music wins Eurovision

Here are some of our recent scores:

Year Artist Place
2011 Blue 11
2012 Engelbert Humperdinck 25
2013 Bonnie Tyler 19

Note that when we are not dragging singers back from the grave, and put a popular band in, we do much better. Blue were already arguably has-beens by the time they entered, and the song was okay and look how much better thet did. Our performance in the votes is correlated to the quality of music we put in.

Sweden, who have been smashing it recently, start picking their song in November. They have a whole music festival to decide on it. They take it seriously: and they win.

Bloc voting isn’t that important

Bloc voting isn’t as important as you might think. The Radio Times have a good write-up of the situation. UCL even published a study showing that while bloc voting has an affect, it is not big enough to prevent a a song winning the contest. Lena’s “Satellite” winning for Germany in 2010 is a good example of this. Germany don’t have many friends, but they still triumphed.

Even if it is, we’re in a bloc

Some would argue that the bloc voting is actual just cultural voting. People like the music of their culture and as their neighbours probably have a similar culture, they are likely to get votes because they share the same music tastes. Whatever the reason, the UK benefits from this.

What country do we give the most points to? Ireland! And who gives us the most points? Yep, it’s Ireland. Our neighbours across the water, France and Belgium, are also some of our most generous donors and god bless Malta who gave this year’s song, that came third from bottom, a full 12 points.

Parenthood and life expectancy

May 27th, 2016 | Health & Wellbeing

father-and-baby

One point of tension for me when becoming a father was the fight between my own needs and that of my family’s. The stress of looking after them and torture of sleep deprivation surely must have a negative impact on my health? How much would I be willing to sacrifice my own wellbeing for theirs?

However, in a speech by Scott Galloway, that I wrote about a few weeks ago, he claimed that being a carer was actually the best thing you could do to prolong your life expectancy. I knew that having a partner and friends was one of the biggest factors in life expectancy. However, he claimed it was the act of giving care that produced the effect. There was no source, so armed with some new hope, I set off to investigate.

Some studies have shown a lower mortality rate in parents than childless adults. However, perhaps it could be that people who want to become parents tend to live longer, regardless of whether they actually have children or not.

In 2012, The Economist wrote about a Danish study that looked at people undergoing IVF. This was key because it controlled for the desire to have children. They found the same result: parents experienced lower mortality rates than childless couples.

Business Insider also wrote about the study noting that men who adopted experienced the same benefit (women experienced some benefit, but not as much as having their own children).

This is all good news. While I am sure the sleepless nights children cause will be very unpleasant, at least there is some comfort that it is actually good for my health.

20-week scan

May 26th, 2016 | Family & Parenting

20-week-scan

Last week we had our “mid-pregnancy anomaly scan” where they check if everything is okay. It turns out it is. Baby seems to be hitting the predicted growth rates perfectly.

Obviously baby has massive head in comparison to its body, but I think we all kind of knew that any child of mine would be a big-head.