Joined June 2012
·

Veera

Software Engineer at Altimetrik
·
Chennai, India
·
·
·

Would love to hear about the reader's tips and tricks! :)

Posted to JavaScript - Module pattern over 1 year ago

I use require JS / AMD which provides isolation of my module variables and prevent them from polluting global namespace.

Posted to Do / While Loop - Java Script over 1 year ago

In this case, do-while loop is more semantically opt, because it executes the loop content for one time and then check for loop breaking conditions. of course, same thing can be done by a while loop also, but do-while is much more readable.

In Windows, I use Mongoose which does the same thing. But, in Ubuntu, I like the Pythonic approach.

Posted to Self-executing anonymous functions over 1 year ago

Also known as, Immediately Invoked Function Expressions (IIFE).

Such a subtle code but huge difference between how they behave. :)

I always have this one defined in my base backbone views to avoid memory leak.

Reference: http://stackoverflow.com/a/11534056

destroy_view: function() {

//COMPLETELY UNBIND THE VIEW
this.undelegateEvents();

this.$el.removeData().unbind(); 

//Remove view from DOM
this.remove();  
Backbone.View.prototype.remove.call(this);

}

What if elements are added dynamically to the page, after the initial cache has been created?

For example,

var imgs = getEls('img');
// some AJAX stuff injects more images to DOM
imgs = getEls('img') // won't this return outdated result from cache?

// If you're trying to start a thread // As far as I know, setTimeout(fn,0) technique is used to push the function execution at the end of the thread (not a new thread). And, isn't the JavaScript single threaded? :)

This is useful. I am also using Jekyll and Disqus combo and was looking for a widget that lists recent comments. Will try to implement this one.

I feel that you are comparing apples with oranges here.

Useful one, when some one do not want to use heavyweights like Modernizr.

But I really hope these techniques of JS detection and having an alternate experience for JS disabled case go away for the goodness of web. Fortunately, it will happen sometime, as Firefox already has removed the option to disable JavaScript from GUI (though, one can still do so via config).

Posted to How to use the new Github over 1 year ago

Good one. I wonder how will Bitbucket respond to this redesign. Moving things to left side, probably!?

Achievements
220 Karma
11,483 Total ProTip Views