Recent Posts
- 10 Things To Do When Launching A Site
- Using PHP to connect to SFTP
- Asynchronous Virtual Pageviews with Google Analytics
- 5 Advanced Text Editing Keyboard Shortcuts
- Get the headers of a HTTP request with PHP
- How-to: Create PDF preview images in PHP – Part 2
- How-to: Create PDF preview images in PHP
- Quick Code: Get the domain name in JS
- Things to think about when designing a logo
- Javascript Array Functions
Topics
ImageXY
ImageXY - Mac OS X Batch Photo Resizer

Quickly and painlessly bulk resize images, change image formats and create web-friendly photos for your website.
Available on the Mac App Store!
Pad A Javascript Number
When doing a lot of front end scripting with Javascript you often find a lot of useful functions missing and so you create your own.
To keep design and content consistent I often pad numbers with zeros to ensure they are all the same width. There is no built in function to do this, so I wrote my own:
function pad(numNumber, numLength){
var strString = '' + numNumber;
while(strString.length<numLength){
strString = '0' + strString;
}
return strString;
}
Enjoy!