Recent Articles

Thinking about the car horn

I was driving down Sepulveda Blvd near LAX when I stopped at a red light. It was one of those lights that just wouldn't turn green. There were very few cars, and I thought about going through the red light, but, I wasn't in a hurry.

Upgrading JavaScript without breaking backwards compatibility

I tried using Coffeescript, looks like it was not made for me. So it is a language with a not so simple syntax that is supposed to compile back to JavaScript. The selling point is, if you come from a OOP background, it makes working with JavaScript easier. The catch is you need to know JavaScript first.

Fictional Performance reviews

In the past 5 years, I have not received a single negative performance review. For every company I worked for, the manager had to be reminded by a third party or me that my review is due. We would go in a small meeting room and he would say good things about me then say something like "I will talk to bob about giving you a raise". The interesting part is if I was to ask them what I was working on they would have no idea.

Creating a simple search algorithm with PHP and MySQL

Search is an important feature on a website. When my few readers want to look for a particular passage on my blog, they use the search box. It used to be powered by Google Search, but I have since then changed it to my own home-brewed version not because I can do better but because it was an interesting challenge.

What makes an AB test irrelevant

I had the chance to implement more than my fair share of AB tests. I used Google Web Optimizer, Visual Web Optimizer, Optimizely, an internal AB test suite, and even wrote my own at some point. I do not claim to be an expert in anyway because there are a too many ways to interpret the results. I cannot tell you the right way to track conversion but I sure can tell you when the metrics are completely irrelevant.


JavaScript Tips and Tricks

String trimming

In modern browsers, JavaScript has a .trim() function on the String object. What it does is simple, it removes the extra whitespace before and after the string. var text = " I have space before and after "; var tr…

Render unsupported HTML5 tags in Internet Explorers

Old versions of Internet explorer do not support new html5 tags. In HTML5 the `` tag for example allows you to embed a video on your page directly into your page, without having to resort to flash. HTML5 shims do not make thi…

Use the triple equal for conditions to avoid type coercion

JavaScript comparison symbol does not work in the same fashion as other languages. The double equal symbol == performs something called type coercion before doing the comparison. What it means is, it forces two values down to…

Every statement must end with a semicolon;

The JavaScript interpreter is nice enough to add semicolons for us if we forget them. For most places this works, but then you get a bug that is impossible to fix, and the debugger doesn't give you the line number where the p…

Combine all variable declarations

It is common to see code where all variables are declared separately in JavaScript. When in a scope, or a function, we have tendency to declare variables in multiple places thinking they are isolated from one another. Here is…