Blog

Some of my recent posts and ramblings.

A simple jQuery plugin pattern

A simple jQuery plugin pattern. I had seen so many different patterns, Addy Osmani has a github repository full of them. This one works best for plugins which don’t have a lot of instances created for them. Like it’s not a good idea to use it for tooltips, etc (the basic jQuery plugin pattern is great for that) but its a great pattern for layout engines or slideshows which are usually called once or twice. I wrote this to avoid using so many ‘this’ and ‘that’ in the code.

The code layout is quite simple. An options and a state variable to keep track of the state and expose that and options, so they can be used for testing. We also expose out all the methods which we want to test or trigger manually in the return block. The ‘create’ method has all the initialization logic, all your event handlers go in the ‘setupEventHandlers’ method, the ‘destroy’ method implementation is optional, its useful to have it for testing which unbinds all the event handlers and clears timeouts.


A Presentation on JavaScript Testing Frameworks

This is a presentation I gave on JavaScript Unit and Integration Testing frameworks at Aol. It covers some, but not all the projects and progress in JavaScript testing. I skipped headless browsers and a few other stuff. I’ll be doing a follow up presentation when I’ve got some test code up and running. I think QUnit and Jasmine are good choices. I like Jasmine’s syntax a little more, but QUnit is used by jQuery. I’ll probably try both, see which fits best for our needs and report back here.


Feynman lectures on physics

I have been doing a lot of commuting for my new job at Games.com (Need to find something closer). Anyway, so I discovered Feynman’s lectures on physics. He is such an AMAZING speaker, talks with a lot of passion, you can feel how much he loves his work. The videos are apparently recommended listening for all physics majors, I wish they showed these to us in school. Here are links to a few.

See the videos


Visualization of US State birds on a map

An interesting visualization of the US State birds. I got interested after seeing the Virginia Cardinal and the American Goldfinch at the regional park. It was surprising to see that a lot of states share the same state bird. The Cardinal seems to be the most popular followed by the Meadowlark and the Mockingbird.

See the interactive map here


John Cleese on Creativity

John Cleese (Monty Python) gives a talk about how to be creative. Really worth watching!


A compilation of Douglas Crockford videos on youtube

I am ashamed to say that I discovered these videos by Doug Crockford so recently. It is a must watch for any web developer. Only a few of the videos are technical, but he explains the history and evolution of the web over the years, the development of javascript and the Microsoft-Netscape browser wars. Very interesting and Crockford makes it very entertaining.

more


CCValidator – A simple client side credit card validator

A jQuery plugin which highlights the credit card issuer and performs Luhn algorithm validation for credit cards. Try it out below (Nothing is posted or saved, it is all client side). It validates on change now, but it can be set to on blur, so its not showing an error message as the user is typing (that might drive a few customers away :) )


After reading the Steve Jobs biography


Troxler’s fading in CSS

Found this on Reddit couple of days back and thought of getting some CSS practice. Webkit only though. Firefox works too without the animation, but you can still see the effect.

Troxler’s fading or Troxler’s effect is a phenomenon of visual perception. When one fixates a particular point, after about 20 seconds or so, a stimulus away from the fixation point, in peripheral vision, will fade away and disappear. The effect is enhanced if the stimulus is small, is of low contrast or equiluminant, or is blurred. The effect is enhanced the further the stimulus is away from the fixation point. Source: Wikipedia

See it in action here


Browseup

After going through another round of frustrations with cross browser compatibility, I created this ‘upgrade your browser’ page. Come on people, browse up.

The design is inspired by the new Blue Screen of Death in Windows 8. Download the code from Github, you can also see a demo of the page here. Switch the theme for a dark version.