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

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…

Checking if variable is an Array

Since the last time I tackled this issue, there has been some improvements to newer versions of JavaScript. The Array object now has the isArray() method. To check if an object is an array, all you have to do is pass it as a …

SetTimeout and SetInterval use eval therefore are evil

Eval is evil. Ok, it's not like it goes out at night and kill kittens but it is evil nevertheless. Let's start from the least evil to the kitten killer. Code passed through the eval compiler is run in a global namespace. W…

For loop does not create a scope

For loop does not create a scope no-new-scope-in-loops Unlike in other languages, the content of a for loop is not in a new scope. Let me show you. var elements = document.getElementsByTagName("*"); for (var i = 0; i &l…

What to use for debugging, console.log() or alert()

When I started using JavaScript, the alert function quickly became my best friend. I didn't use it to display annoying messages to my users. I used to debug my code. The cool thing about it is that it stopped execution of all…