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.
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.
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.
John Cleese (Monty Python) gives a talk about how to be creative. Really worth watching!
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 :) )
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
After going through another round of frustrations with cross browser compatibility, I created this ‘upgrade your browser’ page. Come on people, browse up.