Leeds Festival 2010

8 September 2010

Just recovered, so thought I’d post some ramblings for this year. Various high points were: Colin; gin jam; Jacob and Alf shopping for nothing but sweets; the wind and its army of shopping bags; back on form with brie and crackers; staying at the main stage missing plenty of good bands; acting like we were 16 again; when gazebos attack; a night of rum leading to much destruction; that man’s dressed all in red; wrestling ring during Limp Bizkit; breaking glasses again; general debauchery and merriment. Roll on next year!

Friday Saturday Sunday
Bad Religion
Arcade Fire
The Libertines
Cancer Bats
Zebrahead
The Cribs
The Rats (Gallows)
Modest Mouse
The Gaslight Anthem
Mystery Jets
Random Hand
Rolo Tomassi
blink-182
We Are Scientists
Foals
Weezer
Cypress Hill
Limp Bizkit
You Me at Six
All Time Low
The King Blues
Guns N’ Roses
LCD Soundsystem
The Sunshine Underground
Against Me
Queens of the Stone Age
Biffy Clyro
Lostprophets
NOFX
Billy Talent
The Skints

Tent location

Word Clock v2

8 November 2009

I’ve seen a few nice-looking representations of clocks around, but when I saw Gumuz’s word clock I though I could make some improvements to it. Here’s a couple of the changes:

  • Rewrote using MooTools (only because I know it better, I’m currently developing in it, and it gave me a chance to play with Google’s JS API)
  • Rewrote some of the JavaScript logic to be a bit tidier
  • Replaced the letters with dots for an arguably prettier output
  • Reordered the hours in the HTML so that “twelve o’clock” wouldn’t be missing the space (I had to combine two and one for this)
  • Highlighted the a in half for quarter-past and quarter-to, as per mattatwhoosh’s suggestion
The result is tested in IE (5.5–8), Safari, Chrome and Firefox. I hit a slight issue in IE6− (what a surprise) whereby it interprets a.sec.lit as a.lit (example); I got around it by making sec an ID rather than a class (yes, I know it’s dirty).

Have a look for yourself.

Mootools Hash.setFromPath

23 October 2009

MooTools More implements a getFromPath method in Hash.Extras, but doesn’t provide a corresponding setter. Here’s an implementation:

Hash.implement({
    setFromPath: function(path, value) {
        var source = this;
        var prop = '';

        path.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g, function(match) {
            if (!source) return;
            prop = arguments[2] || arguments[1] || arguments[0];

            if (!(prop in source)) source[prop] = {};
            lastSource = source;
            source = source[prop];
            return match;
        });

        lastSource[prop] = value;
        return this;
    }
});

Just to explain the lastSource part, it’s a fudge to maintain object references throughout.

MLIA

16 September 2009 | 2 comments

Today, after reading over 3000 posts on FML over the the past 6 months, I realised that MLIA is actually more enjoyable than schadenfreude. MLIG is too boring, though. MLIA

Spacing out CamelCase in PHP

27 May 2009

Here’s a nifty function to put spaces in your CamelCased words:

function spacify($camel, $glue = ' ') {
    return $camel[0] . substr(implode($glue, array_map('implode', array_chunk(preg_split('/([A-Z])/',
        ucfirst($camel), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE), 2))), 1);
}

echo spacify('CamelCaseWords'); // 'Camel Case Words'

I added in the $glue parameter to be even more nifty, but a bit of thinking made it clear that it wouldn’t work when the first letter was lower-case. Should be fine now!

2B or not 2B

18 May 2009

…that is the question. The answer? FF.

Paying the Price for Bad Grammar

10 April 2009

This is why we need Grammar Nazis:

Today, I was flirting via text with a coworker. Things started getting heated, and I wanted to send her a sexy picture. I asked if she had any suggestions. She said, “Your nuts!” She meant, “YOU’RE nuts.” I sent her a photo of my junk. I offended a co-worker with incriminating evidence. FML

blizzard_of_77 on FMyLife


Ahh, grammar…

Things I Learnt Today

30 March 2009

  1. That Ben “Yahtzee” Croshaw is a goon;
  2. that his early stuff is, if anything, funnier than his paid stuff for The Escapist;
  3. that I there will always be something on the Internet that I haven’t seen, and that someone will think I have been living under a rock to have missed it.

Get a Grid for Transparent Images in Firefox

17 February 2009

Here’s a useful bit of Firefox hackery for you all. It puts a checkerboard (or chequerboard, for you elitists) image as the background for your transparent images. It works for any image when viewed directly in Firefox, by checking for a HTML page containing a single img tag. If you reproduce this structure manually, then you’ll see the checkerboard, but there’s very little chance that a legitimate HTML page would match these selectors. It works by adding some content to your userContent.css:

  1. Lifehacker has a guide to finding your userChrome.css file — your userContent.css resides in the same folder.
  2. You may not have a userContent.css file; if not, you should create it. In some instances you may have a userContent-example.css file, which you can rename to get the idea of what goes in this file.
  3. Open the file and insert the following CSS:

    /*
     * Image from http://commons.wikimedia.org/wiki/File:Checker-16x16.png?oldid=19631383
     */
    html > body > img:only-child {
    	background: url('http://starsquare.co.uk/images/checkerboard') repeat;
    }
    
    html > body > img:only-child:hover {
    	background: none;
    }
    

    With the above CSS, viewing an image directly displays the checkerboard at all times, unless you hover over the image, in which case it reverts back to show the normal image. If you want it the other way round, so the checkerboard only shows when you hover over the image, insert the following CSS:

    /*
     * Image from http://commons.wikimedia.org/wiki/File:Checker-16x16.png?oldid=19631383
     */
    html > body > img:only-child:hover {
    	background: url('http://starsquare.co.uk/images/checkerboard') repeat;
    }
    
  4. Save the file. If you had Firefox open, you should restart your browser. If not, simply start it up.
  5. Find an image that contains transparency and open it in your browser; a good example is this image.
  6. Pretend you’re in your favourite image editor!
I removed the body:only-child selector, since nightly builds of Minefield include a head tag to specify the page title.

A Message to Tinchy Strider

30 January 2009

It’s misled. I don’t care if you made it up to rhyme with mistreated, or if you use an 8-bit–style riff to appeal to my geekiness — The word is misled. That is all.