Mr Speaker

Yearly Archives: 2013

Short function syntax is here!

It’s happened. It’s finally happened. Short function syntax is here! At least, if you’re running the nightly version of Firefox (which I am now, due to my promise to adopt the first browser to introduce short function syntax). Short function syntax replaces the lengthy function keyword with a symbol =>, and the almost-as-lengthy return keyword […]

#Random Hex colour

Want a random colour between white and black? “#” + (Math.random() * 0xffffff | 0).toString(16) That is all. [Update: after I posted this I thought… i bet this has been done a zillion times already. It was, and by Paul Irish in 2009 no less. Additionally – it doesn’t work. The best looking one there […]

Three.js: looking away from .lookAt

Have a hankering to look in the opposite direction of the vector you get from Three.js’s .lookAt function? You need .lookAwayFrom! Dunno if there’s an easier way, but the idea is find the vector between the target you’d normally “look at” and you, then add the resultant to your current position, and look at that […]

Scala date range

Google it: “Scala date range”. The results are… unhelpful. The top result (a Stack Overflow link, obviously) hints at a workable solution. Here’s my implementation of it: import org.joda.time.{DateTime, Period} def dateRange(from: DateTime, to: DateTime, step: Period): Iterator[DateTime] = Iterator.iterate(from)(_.plus(step)).takeWhile(!_.isAfter(to)) To use it, provide a “from” date, a “to” date and a joda time period: […]

Live editing for game development

Here’s a small demo on how I’ve been using Chrome’s “live editing” features to speed up my development workflow. Chrome let’s you modify currently loaded files on the fly – so you can tweak settings and test code in real time. Don’t forget to keep an eye on the development of my up-and-coming waterski odyssey: […]

Track: Fuck me dead

Just found this weird ol’ track I made a few years ago. Like all my weird ol’ tracks, it was never finished. Now it’s finished.