Tag: snippets

  • Separate Pings/Trackbacks from Total Comment Count in WordPress

    After taking a look at some search results and at Matt Martz’ article, Separating Pings from Comments in WordPress 2.7, I still had some issues with particularly the comment count. There were also a problem with how the functions I have added/modified are being carried across in my templates (but probably are mostly in the…

  • Resize to a Specific Element’s Dimensions

    Here’s a snippet to resize a background image to the dimensions of an element. In this case, #bkgImage. var resizeBkg = function() { var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var e = document.getElementById(‘bkgImage’); if (w > h) { e.width = w; e.height = w; }…

  • Delete .SVN Directories

    Ever accidentally do an svn checkout instead of an export? Here’s a command-line snippet to take care of those hidden .SVN directories: rm -rf `find . -type d -name .svn` Warning: Take great care when using “rm -rf” always.

  • Find Duplicates in Address Book

    Ever had the situation where you have synced your iPhone (to iTunes OS X) and happen to sync both the contacts from your Address Book and Google Contacts? Or, just happen to add someone’s new contact info as another contact-card? Well, here’s how I cleaned and merged duplicate contacts so that my Address Book performs…

  • Detect Operating System with JavaScript

    Here’s a snippet of JS code that might come in handy if you, let’s say, would like to filter out what type of content to display depending on your website user’s OS. A real-life example would be having a download link show up to user’s who have a client that was only published on Windows.…