jQuery: Detect enter key

June 6, 2010

Sometimes it is nice to be able to detect when the user has pressed the enter. This is great for super custom forms and Javascript games. Or maybe a totally custom built app that is waiting for the user to hit enter for some reason. But how to detect the enter key? Luckily jQuery once

Apache: Force HTTPS with .htaccess

June 3, 2010

When HTTPS is required and you are working with an Apache server that parses .htaccess files, here is a handy snippet of code to put in the .htaccess that will cause the server to force every page in that directory and all subdirectories to use HTTPS by sending them to the HTTPS URI if they

PHP: Function to force HTTPS

June 3, 2010

Quite often HTTPS is required for security reasons, but the question is how to force HTTPS with PHP?  Really it is quite simple. Copy the following function into your functions file and call it on top of every page that requires HTTPS to ensure it is used. function forceHttps() { $pageURL = ‘http’; if (!isset($_SERVER[“HTTPS”])

PHP: Remove empty array elements

June 3, 2010

I’ve run across a couple instances where I needed to either remove empty array elements or perform the equivalent of a trim() on PHP arrays. There are two pretty good ways to do this. The first way involves building a custom function to loop through an array and unset empty elements like so: function arrayRemoveEmpty($Array)

Removing those pesky .svn folders Subversion l leaves behind with find

May 27, 2010

When I am working on a project that unnecessarily has .svn folders strew about from Subversion I get a little annoyed. Luckily Linux has a solution (or is the solution!), the find command. find is a tool that can be very simple or very complex depending on how it is used. In this instance I