Skip to content

Instantly share code, notes, and snippets.

View nikhilw's full-sized avatar

Nikhil Wanpal nikhilw

View GitHub Profile
@nikhilw
nikhilw / gist:b07c320e18160ee3d65f
Created March 12, 2015 09:35
List all event listeners on all elements in the currently loaded page.
jQuery("*").each(function(i, e) {var listeners = jQuery._data(e, "events"); if (listeners){console.log(e); console.log(listeners)}})
@nikhilw
nikhilw / DevDocsConfigBookmarklet
Last active August 29, 2015 14:04
Bookmarklet for one-click config of devdocs.io
// For those who have the habit of clearing cookies. this sets the cookie for devdocs.io config.
// modify the 'docs' list to match your requirements.
// Heres the code for the bookmarklet.
(function () {
var d = new Date();
d.setTime(d.getTime() + (21 * 24 * 60 * 60 * 1000));
document.cookie = "docs=backbone/css/git/grunt/html/http/javascript/jquery/jqueryui/node/requirejs/angular/express/lodash/markdown/mocha/mongoose/underscore/chai;" +
"Host=devdocs.io;"+
"Path=/;"+
@nikhilw
nikhilw / customDevLogger_Morgan
Last active August 29, 2015 14:01
Reuse a built-in logging format for Node/Express/Morgan
logger.format("mine", function(tokens, req, res) {
var dt = new Date;
// Key being: all the logging format added internally are available directly as methods: .dev/.default/.full etc
return "" + dt.getDate() + dt.getMonth() + dt.getYear() +"_"+ dt.getHours() + dt.getMinutes() + dt.getSeconds() + " : " + logger.dev(tokens, req, res);
});