How to remove item from array by value?

This can be a global function or a method of a custom object, if you aren’t allowed to add to native prototypes. It removes all of the items from the array that match any of the arguments. To make it a global- And to take care of IE8 and below-

Find an element in DOM based on an attribute value

Update: In the past few years the landscape has changed drastically. You can now reliably use querySelector and querySelectorAll, see Wojtek’s answer for how to do this. There’s no need for a jQuery dependency now. If you’re using jQuery, great…if you’re not, you need not rely it on just for selecting elements by attributes anymore. There’s not a very short way … Read more

Node.js Error: connect ECONNREFUSED

Chances are you are struggling with the node.js dying whenever the server you are calling refuses to connect. Try this: This keeps your server running and also give you a place to attach the debugger and look for a deeper problem.

‘setInterval’ vs ‘setTimeout’

setTimeout(expression, timeout); runs the code/function once after the timeout. setInterval(expression, timeout); runs the code/function repeatedly, with the length of the timeout between each repeat. Example: