Dynamically Resizing Text with jQuery

dynamically-resized-text

Dynamically resized text ensures that when necessary, text can fit to a pixel-perfect width in any browser and any operating system. While fonts are similar enough across most browsers and OS, in headlines or other locations where overflow text would break layout, occasionally, one browser will have issues where otheres don’t. In this case, we [...]

Executing inline JavaScript when using AJAX

javascript document

AJAX is full of stumbling blocks. From browser support to user expectations, it can cause more problems than it solves when used at the CMS level. In AJAXed WordPress, I had to find a way to enable javascript processing on arbitrary scripts from other plugins loaded with AJAX. Typically, this is impossible because most inline [...]

Stripslashes all values in an array with PHP.

PHP Stripslash array

Here is a very simple function to run stripslashes on an array and all of its child arrays. The function below is for PHP 5 and takes a single argument which should consist of an array. It loops through all elements of the array, and if an element is an array, it calls itself on [...]

Another look at jQuery Performance: combining elements and IDs

Profiling jQuery performance

A question that came up in regards to jQuery Performance was: is it faster to define the type of element before you set the ID. Basically, is jQuery('textarea#content_box') better than jQuery('#content_box')? The thinking is that because the latter is more specific, the parser has to do less work to find the element. But this is [...]

jQuery: Fastest method to find Descendents

jquery

In jQuery, there are 5 different selectors that can find an element’s descendants. One of these methods, will grab only first-level children but it is included with the other four to demonstrate the differences. By profiling these 5 selectors, we can get a basic idea of which selector is the fastest, but, as you will [...]

Escaping regular expressions in PHP

really-long-regex-to-validate-emails

Escaping dynamic regex strings automatically in PHP is a lot harder than you would think. You can’t just use a string like"\$myregex" because PHP will try to escape the $. You can’t even double slash it like \\$myregex because this doesn’t work in the regex engine. To get both the PHP and the regular expressions [...]

FireFox Leading the Pack: Gradients on Buttons

gradient_buttons

See those wonderfully beautiful article and comment toggle buttons at the top of every post? (Or in the post image for those reading in a feed reader.) Those are images, but they weren’t created in Photoshop: they are screenshots of buttons designed with Firefox gradients. That’s right, when I was working on them, I wanted [...]

Moving WordPress: Replacing the Old URL in the Database

change-mysql-options

Moving a WordPress website can be quite the hassle, but with the following bit of MySQL it can be a lot easier to switch websites from one host to another. The following is a MySQL search and replace of all fields and text content that could conceivably contain links to your old website. It replaces [...]

CSS only Gradients in All Browsers

css-only-gradient

Currently, it is possible to create CSS gradients in IE 6, IE7, IE8, Webkit-browsers (Chrome 2.0+ and Safari), and Firefox 3.6+. As of this post, Opera doesn’t support CSS-only gradient backgrounds. There are other methods to create gradient backgrounds with JavaScript or via the canvas element; however, I prefer the CSS only methods. Each of [...]