Category Archives: Javascript

The best kind of script

Colourising sprites in Canvas – part 1

First things first: I promise to try to limit the Notch related posts in the future and I apologize to the legions of l337 coders for the continued coverage. Right, now, on to todays topic: “Colour like you’re Notch” (Awright, punning on my own blog post titles!). While watching the livestream of Notch coding Minicraft, […]

_this = this

var _this = this. It always does. I write it oh-so-often to keep my JavaScript scope hanging around – and the idiom no longer makes me cringe. It’s like an old friend. The only problem with my old friend is that Textmate doesn’t have the same feelings towards him as I do. He certainly won’t […]

JavaScript has a lisp

It’s been a while since Slashdot was my regular hang out – so perhaps the demographic has swung radically – but I was amused (and a little bit incredulous) to see a stack of mis-informed javascript hate in the comments of an article talking about Harmony (TC39), the proposed next version of ECMAScript. In the […]

Conventional Interfaces: map/reduce and friends

I’ve had a few queries about some of the code in my Hacker News bookmarklet – which makes use of some JavaScipt 1.6 & 1.8 features: map; reduce; filter; and forEach (sorry, no love for some or every this post). Superficially these are just array methods that take a function and apply it to each […]

HackemUp: A HackerNews bookmarklet

Hacker News is a fantastic source for up-to-the-minute happenings in the nerd world. It’s highly dynamic – like a calm river of nerditry, in which items of interest ebb and flow unceasingly over the front page. Unfortunately it is also addictive – and the highly procrastinative or inquisitive (or worse still, both) individual can become […]

DOMTimeStamp fun

Here’s today’s fun-with-mobiles tidbit of pain. The extremely entertaining Geolocation API (entertaining to use, not to read) provides the current timestamp in DOMTimeStamp format along with geoposition responses. But it seems browsers and devices aren’t 100% in agreement on either what a DOMTimeStamp is, or what it is when it comes back from a geolocation […]

Accelerometer in Javascript

The super-cool Google Jules Verne demo that went up today reminded me that I made an accelerometer tester for the iphone ages ago. It’s an offline app, so don’t be afraid to “add it to home screen” – and if you don’t want to get dizzy, then lock the phone to portrait mode! GO HERE […]

Anonymous functions for inline event handlers

Inline event handlers… remember them?! Yes, they’ve gone the way of the blink tag and Adobe Flash, but recently I used one while debugging and realised: “Hey! I have no idea how to get the event object in an inline even handler!” and, shortly after “In fact, no idea how to write an anonymous function […]

Terrainer: terrain generator

about  Go DefaultSparseLuna Lander 0/Passes Seed size Water chance “smoothing” speed