24 Mar 2009

Whilst playing around with some ideas for a project I have in mind, I have created something else along the way.

I needed the ability to draw lines between elements on a webpage, with some built-in intelligence on how to route the lines so they look sensible. I couldn’t find anything in jQuery, Dojo or elsewhere that did this type of thing out of the box, although I’ll admit I didn’t look too hard.

Having got something basically working, I decided to throw together a demo to help see if they did what I wanted. As is often the case, my little demo has taken a life of its own and has distracted me from the original project I was doing this for.

And so came to life the Logic Gate Thing.

Logic Gate Thing

A couple disclaimers to make: it has only been tested with Firefox on Linux and is reliant on Javascript. That said, I’d be happy to hear how other browsers get on with it.

Update: It should now work on WebKit based browsers; Safari, Epiphany, etc and Chrome. As Jamie points out in the comments, it does work in IE8 albeit with some slightly weird lines.

7 Jul 2008

Having done tetris last week, I got a number of suggestions for improvements in the comments. Whilst I don’t rule out tackling them at some point, I had an itch to do something different. So I started the next project. Admittedly, this one has taken quiet a bit more time to do and it isn’t a finished end-to-end game like tetris is. But still, the concept is there and I could spend some more time on it or I could start the next project.

So, for still no reason in particular, I present to you JavaScript Mario. Enjoy.

30 Jun 2008

Thanks to spending a few hours first watching Jay-Z at Glastonbury and then the 5-set epic that was the Murray-Gasquet match at Wimbledon today, I have found myself sat in front of the laptop hacking away at a little project that came to mind late last week.

I’m sure it has been done many time before, but as I’ve said before, reinventing the wheel can be quite fun sometimes.

So, for no reason in particular, I present to you JavaScript Tetris. Enjoy.

21 Feb 2008
18 Oct 2006

This post is mostly a note-to-self.

Compare the following pieces of javascript:

var list = ['a','b','c'];
for(x in list) {
   alert(x);
}
var list = ['a','b','c'];
for(var x in list) {
   alert(x);
}
 

Either works in Firefox. Only the one on the right works in IE. Hint: the difference is in bold.

The IE behaviour encourages you to define your variables and not get lazy. Given that I develop under Firefox and don’t test under IE until late in the day, remembering this one will be a huge time-saver.