0 notes

mnTextSelector jQuery plugin

I’ve released v1.0 of my new jQuery plugin that allows devs to quickly attached callback functions to user-highlighted text. An example would be if you wanted to allow users to view the definition of a word; they can highlight the word then select “Define” or any other site-defined functions.

I’ve released both the source of the jQuery plugin as well as the source to the companion WordPress plugin, which is now in the WordPress plugin directory:

0 notes

My first publicly released WordPress plugin asked me to create something simple to use that wasn’t intrusive in the WP post editor.

The Diffen WordPress plugin let’s you quickly compare two things using’s embeddable API. Once you get your results, you can resize the generated iFrame embed, and insert it directly into your post like you would a YouTube video.

0 notes

OOM issue in Rackspace Cloud Server

I switched the site I work with over to Rackspace Cloud Server a week ago tonight. For the second night in a row, we have run out of memory and crashed at almost the exact same time, with no spike in traffic.

Once back online, I quickly searched through the logs to find that it was the same issue as the night before: PHP invoking OOM (out of memory) and failing, miserably. Luckily, I dealt with this issue back when I managed my own Xen servers. The solution is pretty simple, but I suggest reading up on what it does before you roll it out into production.

sudo vim /etc/sysctl.conf

Add the following two lines:

vm.overcommit_memory = 2
vm.overcommit_ratio = 80

Save your file, :wq and reboot.

Now your kernel shouldn’t overcommit memory to PHP and eventually fail.

If you want to know why you are doing this, you should read the section titled, “Going in the right direction.

0 notes

EDWIN ZEE: Thoughts on Michael Bay's Reboot of Teenage Mutant Ninja Turtles


So if you haven’t heard by now, Michael Bay is rebooting the Teenage Mutant Ninja Turtles franchise with a brand new movie. While normally this would be good news, there’s just one small detail that ruins everything. Michael Bay has been quoted saying:

Kids are going to believe, one day, that…

(Source: edwinzee)

11 notes

Fun with Regular Expressions: Match Empty HTML Tags

Just wanted to share some regular expression (regex) patterns that I have come up with recently for a project I’ve been working on for a client.

These are currently prepared for use in PHP’s PCRE functions, but for the most part should work with minimal tweaking in any other language that accepts PERL regex.

/<([a-zA-Z]*)( [^>]*?)?>(\s*)<\/\1>/ - matches empty HTML tags.

/ Delimeter required in PCRE.
\< Escaped opening bracket (needs to be escaped in PHP).
([a-zA-Z]*) Matches 0 or more continuous alpha characters.
( [^>]*?)? Zero or more of any character except a closing bracket. This will give us attributes.  The first ? means ungreedy for the 0 or more pattern.  The second ? means 0 or 1 occurrences of the preceding pattern.
\> Closing bracket of the tag, needs to be escaped in PHP.
(\s*) 0 or more whitespace characters, this includes newlines.
\<\/ Escaped opening bracket for closing the currently open tag.
\1 Capture group reference to the matched pattern found at the beginning, this is the HTML tag we matched, so we close the correct tag.
\> Escaped closing bracket for closing tag.
/ Delimiter to end the pattern. 

I’m not a regex expert, so I am sure there is room for improvement here, so please feel free to comment with fixes or adjustments.

Command+H should be the Mac equivalent of the iPad’s home button.

The biggest annoyance I have in Mac OS X Lion is when I try to use a full-screen app I lose the quick Command+H keyboard command.  Since I like to reach for the mouse as little as possible, this leaves me Command+Tabbing to some non-specific app on my “home” Space.

I assume Apple removed Hide functionality from full-screen apps because there is nothing waiting behind them, but doing so killed a well-established workflow. 

So I am proposing that Command+H essentially becomes the equivalent of hitting the Home Button on your iOS device.  On your iOS device it basically hides whatever app is in the foreground, and if nothing is currently running it returns you to your main [iOS] Space.

Now assume Command+H works as it always has, however, if you are in a full-screen app, or a currently empty space, it returns you to your main space.  In this case, Command+H could also be thought of has Command+H[ome].

If you are with me, please file feedback to Apple at

Excellent movie that inspired one of the greatest games of all time.

Excellent movie that inspired one of the greatest games of all time.

I, for one, welcome our new[ly reorganized] Ma-Bell overlords.

History is doomed to repeat itself.  Get ready for lower data caps, poorer service and a larger company that has even less reason to care about the customer.

7 notes