Just a quick one to share a couple of ways to pad a number with leading zeros… I’ve seen a lot of really poor examples of how to do this so I thought I’d share the two ways I might add leading zeros to a number in PHP.
» Read more: Pad a number with leading zeros in PHP
Pad a number with leading zeros in PHP
August 19th, 2010 No comments »Automatic backup all SVN repositories
June 26th, 2010 No comments »Here’s a shell script I use to automatically backup all of my subversion (svn) repositories. » Read more: Automatic backup all SVN repositories
Hosting ga.js locally (google analytics tracking code)
June 22nd, 2010 2 comments »Hosting ga.js locally has two main benefits – fewer DNS lookups for the client’s browser (you could even combine it with your site’s java script to reduce HTTP reqs as well), and you might be able to get it to your users faster than Google can. Whilst the second point isn’t likely true for many, it is true for those of us serving most of our content in Australia.
Google recommends you don’t do this, but doesn’t say you can’t.
» Read more: Hosting ga.js locally (google analytics tracking code)
Compare Transport Routes with Transportle!
May 21st, 2010 No comments »Transportle is a website myself and two friends made for the Victorian Government’s App My State competition.
It allows you to compare different transport routes in terms of not only time and money, but exercise value and environmental impact.
Check out out and let me know what you think! feedback@transportle.com
Google Ascii Art
April 10th, 2010 No comments »Playing with the tool I wrote for my last blog post, I googled “ascii art” and was very impressed by what they do with the Google logo in the search results… Check it out!
ASCII Art Instruction Generator
April 5th, 2010 No comments »My sister is making up some activity sheets for school (she is a primary school teacher) and wanted some instructions on how to make ascii art for the children.
So I made an Ascii art instruction generator so the kids can follow each step to make their ascii art.
The generator is here: http://www.paulferrett.com/tools/ascii_gen.php
Update “overflow: hidden” style of the HTML tag error in IE
March 16th, 2010 1 comment »When trying to update the “overflow: hidden” style attribute of either the body or the html tag using JavaScript, unsurprisingly, IE throws an error… However using the magic of prototype I found a very simple way of achieving this that keeps Microsoft happy – even IE6.
» Read more: Update “overflow: hidden” style of the HTML tag error in IE
Validate Australian phone numbers in PHP
January 22nd, 2010 No comments »Here is a very basic PHP function to validate Australia phone (landline and mobile) numbers.
function validate_phone($number) { $number = preg_replace('/[^\d]/', '', $number); return preg_match('/^(0(2|3|4|7|8))?\d{8}$/', $number) || preg_match('/^1(3|8)00\d{6}$/', $number) || preg_match('/^13\d{4}$/', $number); }
Fixing Selenium typing errors in Firefox
January 20th, 2010 No comments »I recently updated our Selenium Remote Control (RC) testing tool to v1.0.1 so that we could test our site on Google Chrome (and, somewhat tentatively, IE8). We have been using this tool with varying success for quite some time now, with our tests written in PHP. The update process was generally smooth but one annoying bug persisted – Selenium would no longer type the ‘y’ key in Firefox (2 and 3). As a result many of our tests broke simply because the input typed into a text box did not match what was intended.
Triple J’s Hottest 100 2009 Song List Previews
January 6th, 2010 No comments »When it comes to voting for Triple J’s Hottest 100 I always struggle to think of the songs I want to vote for. I know the songs if I hear them, but can’t think of the artist or title in most cases. A really useful thing would be a list where I can see all the songs I can vote for, with a preview of each next to it.
I haven’t been able to find anything like this so far on the ‘net, so my friend, Tommy, and I went ahead and made one! This is a list of all songs you can vote for in the 2009 Hottest 100, along with a YouTube video preview of each one.
Check it out here: Hottest 100 Song List with Preview. Hope you like it!