Code

No. 786 / A quick note about formatting strings

I’m writ­ing this because I just saved 8 – 10 lines of code by using printf(). I know it’s pretty easy to rely on con­cate­na­tion to print strings, but lib­eral use of printf() and sprintf() can add clar­ity to your code and cut com­plex­ity. Take the fol­low­ing, for exam­ple: No big deal. Now,…
Read more →

No. 718 / Moving Subversion repositories from Dreamhost to Mediatemple, Part 1

I recently cre­ated a Medi­atem­ple (dv) host­ing account, and am mov­ing all of my sites over to it. I’ve still got some data­bases to move, and some Word­Press instal­la­tions to relo­cate, but I have suc­cess­fully moved all of my most impor­tant Sub­ver­sion repos­i­to­ries over. I rely on heav­ily on svn, and wanted to…
Read more →

No. 731 / We Don’t Need No Hooks

Excuse the title, please. It’s a ref­er­ence to an old Shaq song (yes, a Shaq song) and I couldn’t pass up the oppor­tu­nity to use it. As a staunch sup­porter of the won­der­ful Word­Press plat­form, I often find myself tout­ing the won­ders of Word­Press and bad­mouthing other pop­u­lar and sim­i­lar PHP-based solu­tions — most notably Dru­pal, note the…
Read more →

No. 759 / Theme upgrade

Excuse me while I work out the kinks. Hope you find the new theme to be interesting.

No. 740 / Debugging Data in PHP

My buddy John C. Bland II men­tioned some debug­ging func­tions I wrote up a while back while we worked together on some code for Ele­vate (an amaz­ing com­pany, by the way). I’d first seen some­thing very sim­i­lar to his dump() func­tion at a pre­vi­ous job (although it was named debug() there), so I felt…
Read more →

No. 735 / Add Relative Links to WordPress Menus

Really quick, here’s a func­tion and cor­re­spond­ing hook that will loop through the links in your menu, fig­ure out which ones don’t begin with a “/” or “http” and prepend them with your site’s URL and a “/”: