IE8 CSS Hack

Thursday Sep ‘10 2

I just discovered a CSS hack that applies to IE6, 7 and 8. It is basically just \9 right after the property declaration, but before the closing semicolon.

For example:

div {
    -ms-filter: "progid:DXImageTransform…";
    margin-right: -2px\9;
}

Plucked from a more comprehensive list of hacks at paulirish.com

This is starting to get a little out of control with IE6, 7, 8 and 9 on the horizon. this is beginning to look like a much better idea…

Leave Your Reply →

The right way to generate months

Tuesday Jun ‘10 29

I recently wrote this (partial) piece of PHP code to generate a list of months in a year:

for ($i=1; $i<=12; $i++) {
    $monthStamp = mktime(0, 0, 0, $i);
    echo date('F', $monthStamp);
}

Today, I suddenly have two “February”s in the list. Not Good. I missed the part in mktime()‘s docs that mentions that missing arguments will default to the current time, so the code was generating a timestamp for Feb 29 2010 (which mktime() interprets as Mar 1 2010).

So note to self—the fix is explicitly specifying the day of month (just “1″ in this case):

for ($i=1; $i<=12; $i++) {
    $monthStamp = mktime(0, 0, 0, $i, 1);
    echo date('F', $monthStamp);
}

Leave Your Reply →

Comparing dates in JavaScript

Wednesday Jun ‘10 2

Turns out that we can directly compare two native Date objects in JavaScript using normal comparison operators like =, < or >, since the comparison invokes valueOf() of the object, not toString(). Therefore, there’s no need to call Date.getTime() to compare timestamps.

Kudos to T.J. Crowder for his well-researched post.

Leave Your Reply →

Word Movement in Terminal

Thursday May ‘10 13

I had trouble finding the right incantations on Apple Terminal to make the ⌥← and ⌥→ shortcuts work.

The instructions are right here.

Leave Your Reply →

“Get Rid of the Crappy Stuff”

Tuesday Apr ‘10 27

More nuggets of wisdom from The Jobs to Nike’s President & CEO, Mark Parker on Fast Company:

“Just get rid of the crappy stuff and focus on the good stuff.”
— Steve Jobs

Leave Your Reply →

One liner to add a public key to a remote authorized_keys

Wednesday Apr ‘10 14

From the very, very useful Top Ten One-Liners from CommandLineFu Explained:

 ssh remote-machine 'cat >> .ssh/authorized_keys' < .ssh/id_rsa.pub

Leave Your Reply →

Syntax Highlighting for QuickLook

Tuesday Mar ‘10 30

More comprehensive syntax highlighting for Snow Leopard’s QuickLook: qlcolorcode

Leave Your Reply →

Triggering quirks mode in IE

Thursday Mar ‘10 11

When XHTML was all the rage years ago, it was common knowledge that an XML prolog declared before the doctype will trigger quirks mode in IE6. That has been fixed in IE7.

However, I found out that actually anything at all, except for white spaces and the XML prolog, will trigger quirks mode in IE6, 7 and 8 for doctypes that should otherwise trigger standards mode.

So if someone decides to add <!-- $Id$ --> to the first line in the HTML file, it will trigger quirks mode in IE. Now you know too.

Leave Your Reply →

Is this why IE6 doesn’t support PNG24?

Monday Mar ‘10 8

So Mosaic‘s source code has just been released on GitHub, and a sharp eye at Reddit has already spotted this gem (keep in mind that IE is originally derived from Mosaic).

Assuming that IE was actually derived from this code base, may I present the reason we had to work around PNG24 for almost a decade:

/* its #if'ed out for now cause I don't have anything to
   test it with */

1 Comment →

HTML5: <!DOCTYPE html>

Sunday Mar ‘10 7

All the cool kids have started using the new HTML5 doctype:

<!DOCTYPE html>

It triggers standards mode even in shitty browsers, so we can dump its verbose predecessor and start blazing a path of HTML5 glory.

Leave Your Reply →