Find element with jQuery containing case-insensitive text

I recently had the need to find an element on a page based on its text content, but it needed to also be case-insensitive. Finding an element on the page based on its text is easy enough using the jQuery :contains() selector, but the text passed to this selector must match case, letter for letter.

Instead of modifying the functionality of a core jQuery selector, I created my own custom selector called :icontains(), where the "i" indicates case-insensitivity. I created a Gist for this, shown below.

Introducing jScroll

jScroll is a jQuery plugin I have developed for infinite scrolling, lazy loading, or whatever catchy phrase you may know it as. A real-world example of this behavior is your Facebook News Feed, which automatically loads content as you scroll down and reach the end of the page.

I decided to develop this plugin because I did not find any jQuery plugins out there that suited my needs precisely, or any that I could even get to work very well. For more information on jScroll and its use, please visit There is no extensive documentation at this time, as the plugin is fairly simple and was developed ad hoc. I plan to continue its development and add features, however, over an indefinite period of time.

A real-world example of jScroll infinite scrolling can be seen at Hang3 | Social Classifieds.


As of version 2.0, jScroll now supports full page scrolling and auto paging once you reach the padding threshold from the bottom of the window. Window scrolling versus inside of a div scrolling is detected automatically based on the style properties of the div, i.e. if it is set to overflow “auto” or “scroll.”

Learn more at
Example use at
Download the latest version at

Like the Facebook Page for Commit Updates

Safe Firebug Console in Javascript

Firebug‘s console object is an extremely useful tool for debugging and logging javascript interactions and responses, especially when working with AJAX and JSONP. What is not useful, is that when using the console object’s methods directly in your included javascript code, it will not work in most browsers other than Firefox, and of course it will cause errors if you (or your users) do not have Firebug installed.

Many of us have made the mistake of sometimes forgetting to delete our console code after testing and before launching our javascript to our production site, thus causing javascript errors, breaking the UI, or perhaps even breaking an entire application, depending on how javascript-dependent it is.

I aimed to solve this problem, and not just the problem of leaving the console code in my javascript by accident, but to allow it intentionally, if I wish, without breaking any browser that does not support it. Continue reading Safe Firebug Console in Javascript

Search Engine Friendly URLs in CakePHP

One thing that is not built-in to CakePHP is the ability to use search engine friendly controller and action names when those names consist of more than one word. CakePHP does an excellent job of allowing friendly URLs in general, but this typically involves single-word controller and action names. So what about controller and action names with multiple words? In CakePHP, this is handled with class names defined in CamelCase and method names defined in camelBack. Continue reading Search Engine Friendly URLs in CakePHP

PHP Coding Guidelines

The following PHP coding guidelines represent my own conventions and standards which I code by, along with some CakePHP conventions when developing with CakePHP, my PHP MVC framework of choice.

These PHP coding guidelines are by no means an industry standard, nor are they intended to tell you PHP coders out there how things should be done. I simply want to share the PHP coding guidelines which I follow and enforce when working with other developers on larger projects.

Laying down some coding guidelines like these helps to provide a more structured and rapid development environment, and makes the PHP code more predictable and easier to debug. Continue reading PHP Coding Guidelines

Windows Vista Woes

I recently caught a glimpse of Windows Vista at a local Best Buy while shopping for a new notebook computer. To say I was unimpressed would be an understatement.

Aside from a few UI updates and some fancy transparent window effects, Windows Vista is really not all that different from Windows XP. In fact, much has evidenced that Windows Vista is lacking in software support as compared to Windows XP.

And Microsoft certainly wasn’t shy about copying ideas from Mac OS X. Vista features a search-as-you-type input from its start menu, with the same functionality and a strikingly similar search icon to the Mac OS X Spotlight feature. Vista’s newly entitled Window Switcher feature, accessible via Start-Tab, also closely resembles Mac OS X Expose. And the list goes on. Continue reading Windows Vista Woes

PHP, CakePHP, JavaScript, jQuery & More