Quick Tips Tutorials
JavaScript Debugging Tip: Objects
Every so often I want to view what an object looks like at various points of an execution cycle. Many people like to use breakpoint debugging but I find it a bit annoying and tedious -- it's simply not for me. The problem comes when I...
Firefox Button Height Fix
One problem I've seen on occasion is that button heights in Firefox are a few pixels larger than in other browsers. This can be a nightmare when trying to unify the size of buttons with an
A
elements, as we found out when implementing a new...Prepend and Append Files with .htaccess
One of the lessor known and used capabilities of .htaccess files is the ability to prepend and append includes to every page request. Doing so avoids needing to code
<?php require('footer.php'); ?>
in every template file you wat to use them in. Here's the .htaccess code: Now...Sort Objects by Property with PHP
I recently needed to display a list of authors within a WordPress blog. The goal was to sort the author list by number of posts before outputting the list. The method for calculating number of posts isn't a sortable key within WordPress'
get_posts
, so I had...Override WordPress URL
When I migrated my website between Media Temple servers, I wanted to manually test the site to ensure no server configuration differences between the server were bricking the site. The obvious problem I would encounter is that links would be broken because the site wasn't...
parseInt and Radix
Everyone knows that the parseInt function within JavaScript turns your decimal number or string into a rounded integer.
parseInt
turns 10.937 into 10, 0.2 into 0, and "someValue" intoNaN
. If you useparseInt
without a radix, however, you'll receive a warning that no radix has...Hide the Admin Bar in WordPress
WordPress automatically injects an admin toolbar at the top of the page for logged in users. This bar is really an annoyance to me because it slightly throws off my theme design and I never need the toolbar for anything. Here's a snippet of code which...
Convert arguments to Array
The
arguments
object thats automatically available within functions can be a source of confusion for some people; it's kind of an array but it's kinda not. JavaScript is awesome in that you can pass any number ofarguments
to a function, and oftentimes developers need to...CSS tab-size
The ridiculous tabs vs. spaces debate within code can get just as heated as the JavaScript semi-colon debate. I'm a tab guy myself but to each their own...just don't work on a project with me if you aren't. Anyways, I was quite surprised to find...
Convert NodeList to Array
Now that most browsers have implemented querySelectorAll, the native selectorEngine, many framework-dependent developers are getting a rude awakening when dealing with the result of QSA calls: the NodeList object. NodeLists are array-like but don't feature many of the methods provided by the Array, like
forEach
,map
...