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
/** | |
* ServerStatsBootstrap.js | |
* Bootstrap module to log server version from package file | |
*/ | |
module.exports = function (done) { | |
require('fs').readFile('package.json', function (err, data) { | |
// exit if error in reading file | |
if (err) { | |
sails.log.error('Unable to read package. %s', err); | |
return 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
/** | |
* Bootstrap | |
* (sails.config.bootstrap) | |
* | |
* An asynchronous bootstrap function that runs before your | |
* Sails app gets lifted. | |
*/ | |
module.exports.bootstrap = function (callback) { | |
// load all modules *Bootstrap.js in bootstrap directory | |
// and execute async |
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
/** | |
* This function ensures that the event object always has pageX and pageY irrespective of the | |
* browser. Older IE browsers do not support pageXY. | |
* | |
* @param {MouseEvent} event | |
* @returns {MouseEvent} This function updates the events `pageX` and `pageY` properties when | |
* they're missing and also returns the same event for the sexy programming styles. | |
*/ | |
var getEventCoordinate = (function () { | |
var PAGEX = 'pageX', |
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
var getClipboardDataAsText = (function () { | |
if (window.clipboardData && window.clipboardData.getData) { // Browsers with global handler | |
return function () { | |
return window.clipboardData.getData('Text') || E; | |
}; | |
} | |
// For event specific paste supported browsers | |
return function (referenceEvent) { | |
return e.clipboardData && e.clipboardData.getData && e.clipboardData.getData('text/plain') || E; | |
}; |
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
/** | |
* Check whether an object is Array or not | |
* @type Boolean | |
* @param {object} subject is the variable that is | |
* tested for Array identity check | |
*/ | |
var isArray = (function () { | |
// Use browser's own `isArray` when available | |
if (Array.isArray) { | |
return Array.isArray; |
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
/** | |
* Returns unique GUID on every call as per pseudo-number RFC4122 standards. | |
* | |
* @type {function} | |
* @returns {string} | |
*/ | |
module.exports = (function() { | |
var E = '', | |
H = '-', |
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
/** | |
* @example | |
* var args = require('./quickargs.js')(process.argv); | |
*/ | |
module.exports = function (argv) { | |
var args = {}, // object to store all key-value argument extraction | |
lastarg; // args are split by space, so we keep a track of last key detected | |
argv && argv.slice && argv.slice(2).forEach(function (item) { | |
lastarg = /^-/.test(item) ? item.slice(1) : (lastarg && (args[lastarg] = item), undefined); |
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
/** | |
* Bootstrap module for Slack notification on server startup | |
* | |
* Expects: config/slack.js | |
* - enabled | |
* - organisation | |
* - key | |
* - messages.spawn | |
* - payload | |
*/ |
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
echo -n "ACT Data Usage Info:"; | |
# Fetch Url, locate line with quota and remove HTML tags | |
curl --silent --url "http://portal.acttv.in/index.php/mypackage" | grep 'Quota' | sed -e 's/<[^>]*>//g' -e 's/\ /\ /g'; |
OlderNewer