Archive for June 2010

Add leading zeros to a number in Javascript

Needed a quick way to add leading zeros to numbers for a js countdown script. Not hard to do, now I can look at this post for the code when I need it again.

function addLeadingZeros(n, totalDigits)
{
if(!totalDigits)totalDigits = 2;
n = String(n);
while (n.length < totalDigits)
n [...]

Remove Crap from Wordpress dashboard

Wordpress is great software. I love the UI. I don’t like the extra clutter in the dashboard and neither do some of my clients. Getting rid of it (or adding to it) is fairly easy. See http://codex.wordpress.org/Dashboard_Widgets_API for all that you can do.
If you just need to quickly trim down the dashboard use [...]

Time Sheet, a nice Windows app for time tracking

Found a great time tracking application for windows : Time Sheet .
You can train it to associate an application/document title with a project and track the time entered.
From the website:
"TimeSheet is a powerful automated time & task recording tool for professionals.
It will improve your accountability by increasing the billable hours: let the [...]

Trimming whitespace from a field in MYSQL

Sometimes whitespace in user entered data can be annoying. Even more annoying if it is imported data, or better yet your fault for not trimming the input. Anyway, its a simple matter to trim a field in MYSQL – see the query below , preserved here for posterity.

UPDATE tablename
SET fieldName = TRIM(fieldName)

Vimeo Embeds on the iPhone

Vimeo does not (at the time of this writing) have an iPhone/Pad version of their embed code. After seeing this solution , I had a need to do something similar but with all Vimeo embeds sitewide.
jQuery to the rescue and must be included for this to work – best used in a dom ready event.

[...]