Clinton Montague

Developer, learner of things, functional programming enthusiast, hacker, and all round inquisitor.

Using a for loop, print the numbers from 0 to 5

March 16, 2009

I’ve been training for a ZCE certification, and found myself getting quite annoyed with some of the more obvious questions. One of the questions in the beginning of the test was which of the pieces of code would output the numbers 0 to 5 using a for loop. I mean, come on! I present some of my more creative and twisted ways of completing said task.

Operator precedence – what does (i=1)*i– – –i*(i=-3)*i++ + ++i equal and why?

February 22, 2009

I was looking at some code from a number of years ago and was horrified by the amount of ‘clever code’ in there. After decoding it, I immediately rewrote it. Then I set myself a challenge. Write the dirtiest expression ever to besmirch a hard-drive, then decode it in a blog post. I present to you with the fruit of my labour.

How to stop pesky spam by blocking IP addresses from visiting your blog

February 9, 2009

I had a lot of spam from a particular IP *cough* 194.8.75.149 *cough* so I wanted to stop access to the site from the IP. Using only 3 lines in my htaccess file, I managed to cut down my spam by 4 an hour!

isittheweekendyet.co.uk

January 28, 2009

Quickly find the answer to one of the most important questions of all – is it the weekend yet?! It’s completely pointless, made by yours truely, and so easy to use that you just have to load the page to find the answer. isittheweekendyet.co.uk

Creating your first jQuery plugin

January 26, 2009

It sounds like something that only javascript pros could do – make a plugin for jQuery. It took me a while before I even looked into it for the same reason. Around a year ago I tried it, and I want to show you just how easy it is.

AJAX is easy, but remember accessibility

January 18, 2009

AJAX is easy. It’s just javascript talking to your server to grab a little bit of content instead of the browser grabbing the whole thing. With this in mind, let’s get to work and build a simple AJAX application that will work with javascript turned off. We’ll do this by assuming that there is no javascript in your user’s browser, then use jQuery to change the DOM to add in the behaviours.

Better, faster and more robust rollovers with CSS sprites

December 9, 2008

Learn how to create faster, standards compliant, javascript-less and accessible buttons using only CSS. Even the most hard-core of javascript programmers will admit that actually, they might have done this by mistake. And I promise to show you how, and if you’re lucky explain why.

I’ll even tell you what a sprite is.

Create cool slidy drawers with jQuery

November 16, 2008

In this tutorial, I will show you how to make cool sliding content using jQuery. And the best part is that if javascript is disabled, the content will still display very nicely.

Using ems to Specify px Text Sizes in CSS

We all know that internet explorer is the runt of the browsers. In yet another rebellion, it simply refuses to scale elements which have been specified using pixels. In this tutorial I will show you how to think in pixels but work with ems.

Seperating HTML, CSS and Javascript – unobtrusive javascript

So with all of this web 2.0 hype you want to add in loads of cool CSS behaviours, javascript wotsits and AJAX wangdoodles to your website. But then you’re told that you have to keep the (X)HTML clean. ‘What the?!!’ you may ask. Read on to find out how the voodoo is done.