Archive for January, 2011

Random Isometric Map Generation

Friday, January 14th, 2011

My new JS demo uses HTML5 Canvas to generate a random isometric map. You can see it in action here:

Isometric Demo

The algorithm is simple, it selects four random points and then grows recursively until all the map is filled.

HTML5 for IE

Thursday, January 13th, 2011

This script allows you to use HTML5 tags (nav, header, footer, etc) in Internet Explorer 7 and 8.

To use it put this code in your page:

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Preventing Text Selection using Javascript and Event Handlers

Wednesday, January 12th, 2011

To prevent text selection of any element use:

in Firefox, Opera and Webkit based browsers (Chrome, Safari, etc) this can be achieved by setting a CSS property.

-webkit-user-select:none;
-moz-user-select:none;
-o-user-select: none;
user-select: none;

user-select is part of the CSS3 standard.

For IE < 9 we have two options:

Using javascript:

onselectstart="return false;"

and using the HTML attribute

unselectable="on"

Ruby Ternary Search Tree Implementation

Monday, January 10th, 2011

Simple Ternary Search Tree Implementation in Ruby.

Currently supports: