Geoff's Blog

Case-sensitive attribute selectors in CSS

Published 21 November 2016 at 07:47

I recently came across an odd problem in CSS. The default styling of the <ol> element can’t always be replicated by a stylesheet. This means you might want to be careful with ‘reset’ styling that you won’t later be able to override.

Continue reading…

The Google Analytics tracking code

Published 1 November 2014 at 12:17

I’ve recently been fiddling with some Google Analytics stuff (partly to help with a Google Analytics training course) which involves adjusting the tracking code to make use of some of the more advanced GA features. I wanted to understand what the snippet of JavaScript Google provides actually does.

Continue reading…

Chrome on Windows can't render Roboto Light

Published 22 July 2014 at 10:15

We've been having some problems with the changes we made to our site's design, specifically our choice of the Google Android font Roboto Light for the main body text. We've deployed it as a web font, and it seemed to work everywhere just fine. Until, that is, we got reports that it wasn't rendering properly in Chrome on Windows. Ironically, the only browser that can't render this font is made by the same people who made the font itself.

Continue reading…

Converting to particular primitive types

Published 11 July 2014 at 13:13

JavaScript has some built-in functions which can force conversion to a particular primitive type. For example:

var num = Number("23");
// typeof num === "number"

var str = String(23);
// typeof str === "string"

var bool = Boolean("foo");
// typeof bool === "boolean"

If you pass the correct primitive type to these functions, then they're a no-op, that is they just return the original value. So Number(23) will return a value of type number.

Continue reading…

Sorting arrays in JavaScript with some Perl tricks

Published 5 July 2014 at 18:12

I've recently needed to sort JavaScript arrays in a couple of different projects, and in both cases the sorting had to be done on more than one criteria. Sorting in JavaScript is as simple as calling the .sort method on an Array object, and optionally passing in a function (usually an anonymous function) to do the comparison.

Continue reading…

Lexical ordering of Hawaiian words

Published 11 August 2013 at 21:42

In order to update Wiktionary's index of Hawaiian words I tried to figure out how they should be sorted. It turns out it's a bit tricky to find out about this, so I'll make these notes for the future.

Continue reading…

Response to Parental Internet Controls consultation

Published 7 September 2012 at 08:12

Below is the submission I sent to the UKCCIS (UK Council for Child Internet Safety) in response to their consultation on imposing network-level filtering by default on all UK ISPs, raising some of my concerns with the idea.

The PDF version I sent to the council is also available.

Continue reading…

Uploaded Lua modules to Gitorious

Published 21 July 2012 at 13:30

I finally got round to uploading the Git repositories for my Lua modules to Gitorious. Well, I've created projects and uploaded the repos for all of the old ones, but I haven't bothered for the SmplTmpl templating module yet. I really only wrote that for making this website, and it's probably not much use to anyone else.

So I now have a Gitorious project page [update: unlinked because Gitorious now seems to be dead]. Whether or not this will turn out to be useful remains to be seen.

Continue reading…

Munging Git version control history

Published 16 July 2012 at 10:11

I've been digging up my old Lua modules to republish them on the new site, but most of them are in one big Git repository. I've since learned my lesson, and now create a small single-purpose repo for every separate thing. (One of the best things about Git is that when you start something new, even if it's unlikely to turn into anything serious, you might as well just do git init and keep a history, just in case it turns out to be useful.)

I want to put my Lua modules up in public like everyone does nowadays, but I don't want to publish a monolithic repository, which contains not only my open source projects, but also some experimental modules that turned out to be a bad idea, and are best kept to myself to avoid embarrassment. So to do this I've had to figure out how to split out the bits of the code tree and history relevant to each project and turn them into stand-alone repositories. Fortunately, Git has some nifty features to do this.

Continue reading…

Redirecting to a www subdomain

Published 14 July 2012 at 18:29

I decided to put this website on the www subdomain, since it's a clue to users as to what to expect. The Bytemark account I'm borrowing from my friend's training company provides the same content without the subdomain. It's good practice, when both domains lead to the same content, to redirect one to the other. That will keep URLs consistent and make sure each page has only one canonical URL.

Continue reading…