This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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=/;"+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery("*").each(function(i, e) {var listeners = jQuery._data(e, "events"); if (listeners){console.log(e); console.log(listeners)}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".display-price").each(function(i, app) { | |
if (parseInt($(app).text().replace(/Rs\.\s/gi, "")) < 50) { | |
var appDetails = $(app).parents(".details").find(".title"); | |
if (appDetails.attr("title")) { | |
console.log(appDetails.attr("title") + ": https://play.google.com/" + appDetails.attr("href")) | |
// Or even: window.open() | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($, window, undefined) { | |
function AsyncEachHandler(arr, it, done) { | |
var defs = []; | |
$.each(arr, function(i, item) { | |
var def = new $.Deferred(); | |
defs.push(def); | |
it(item, function(err) { | |
console.log("in here") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
mysql -u root -proot -e "select id from information_schema.processlist;" | grep -e [0-9] | while read in; do mysql -u root -proot -e "kill $in"; done | |
echo "verify" | |
mysql -u root -proot -e "select count(id )from information_schema.processlist;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# When running for first time, have empty directories; skip the setup by unchecking all plugins, etc. | |
# then shutdown jenkins, add old files and restart. | |
# If it fails, make sure the directory docker-volumes/jenkins and all its children are owned by same user, owner of the docker process. | |
# Or just chown -R on the jenkins directory. | |
docker run -it --name jenkins --network="permanet" --ip="172.30.0.6" \ | |
-v /home/nikhil/.m2:/var/jenkins_home/.m2 \ | |
-v /home/nikhil/.gradle:/var/jenkins_home/.gradle \ | |
-v /home/nikhil/.npm:/var/jenkins_home/.npm \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// NOTES: | |
// 1. This is one of the three implementation, if you do not have 'node' installed, there is a 'python' and a 'scala' counterpart. | |
// 2. To use this file, place it in .git/hooks/ in your repository. | |
// 3. You can also use this script with the 'husky' npm module. | |
var fs = require("fs"); | |
console.log("INFO: Validating git commit message......."); | |
var msg = fs.readFileSync(process.argv[2] || process.env.GIT_PARAMS || process.env.HUSKY_GIT_PARAMS, "utf8").replace(/\n/g, " ").substr(0, 50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollLogUp(times, currVal) { | |
currVal = currVal || 0; | |
if (times > currVal) { | |
scrollLogUp.timer = setTimeout(function() { | |
document.getElementsByClassName("cwdb-log-viewer-table-body")[0].scrollTop = 0; | |
scrollLogUp(times, ++currVal); | |
}, 1000); | |
} else { | |
console.log("done..") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# aws cli works with both: environment variables and values configured with `aws configure`. | |
# If our own script come to use env variables, like in case where we need to guess the url of a ECR reposiroty, | |
# there is hardly any support to load the profile values into environment. | |
# This script does just that! | |
set -e | |
profile="default" | |
#echo $profile |
OlderNewer