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
console.log(new Date().time(),'[INFO]','Testing...'); | |
Number.prototype.pad = function (len) { | |
return (new Array(len+1).join('0') + this).slice(-len); | |
}; | |
Date.prototype.time = function () { | |
var dateMS = this; | |
return dateMS.getHours().pad(2)+':'+dateMS.getMinutes().pad(2)+':'+dateMS.getSeconds().pad(2); | |
}; |
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
Usage | |
Hello world: | |
$ pm2 start app.js | |
Raw Examples | |
# Fork mode | |
$ pm2 start app.js --name my-api # Name process |
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 result = str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) { | |
var result = index === 1 ? letter.toLowerCase() : (!isNaN(last) ? letter.toUpperCase() : ' '+letter.toUpperCase()); | |
last = parseInt(letter); | |
return result; | |
}); |
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
$('#password').tooltip({ | |
trigger: 'manual', | |
template: '<div id="owaspResponse" class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' | |
}); |
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 util = require('util'); | |
var parser = require('xml2json'); | |
var express = require('express'); | |
var app = express(); | |
app.use(anyBodyParser); | |
app.post('/xml_to_json', function (req, res) { | |
var json = parser.toJson(req.rawBody, { arrayNotation: true }); | |
res.send(json); |
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
view = Marionette.ItemView.extend({ | |
initialize: function() { | |
this.listenTo(this.model, 'change:detail', this.calculateTotal); | |
this.listenTo(this.model, 'change:total', this.render); | |
}, | |
calculateTotal: function() { | |
var newTotal = calc(); | |
this.model.set('total', newTotal); | |
} | |
}); |
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
N4Ig+glgJiBcIFYAsA2Axig7GgjAn2aAZkgEw4DMVSRKAnCADQgB2AhgLYCmcIAYgHsAThzYAXAQAIAqiwhopULpICyAgG4QOELiwmSlkgApchAZwHsANkxBmIALx7xSmOgA9yKW8J17xEJa86rYADmwA5lxmcADaoPZOvK4eXraQMPDI6Fi4+IQk5FQUNChsthBiXBwxsPGsnM4gUOICZqGmFtbRtlBauvaWtaAAFlwQESNicKR0AAzMAO7QYiNwmEgLIACecAQIzO4zCAC+zAKhYoEsw3Zi21bOoFXu07CgbFYTLLyPRNNnEBESxvUCLcaTN6sYSiGzMRJNFgwz4gQFaSJPED3Dq8MxiIRcMRoNaAgBGwiUQjgz22OPgFi+MBOzOYLTE5XeIHRUTgLAArlYrMxQlY2GguCMBFZKbwjKLxZLpaZbKLSVwbPAACKtMzGTqWT49QHhAl6XkCoVY2lNMxcNBXILMNAE8RcTIgVGMUDsbi8CAsUJ8sQ4Xr9G7XW5jCZTOCbJYrNawUgoA47GZzLZHJOnc6XCPUu4PTEvUEgT7fX5cf6eoEggvg6NQpEiFHwxw22E2NGiHmc7E2/GE4k18lCGV9624qXQVEs5riDmgbnOfmC4XyiVS8cgAAyWkdIFV6t4AEEOoLoFIjK6hEiaybdFC2W0OuYDY8Ysx+36A0HbM6uFdd1PW9RpfjYNUrBDVkw0GG4CyjSFjnjKBVnWOM01gfZDmOQELgdeDOTxIsCxLAtywiH54HFPRlUBYEzU5BskPgZtYVsBFwKEHluwxUjJ3pQciRJZhR3HGk6TsacmTnNlFy5HsVwtdcxU3JUqXgOVVMVGVmCPDUQE1E8ABUAHkAGVjAAUQAJXM0yADkTx3KzzPvNhTSfHVXy6Q1PytSTVnVCDjydF0qmAs5QN9ek7QI0hQ24cMhgQiEYywjMULQ2A6FTXZYAQTNcNzAjbmIx5SK4V5yK+SjK2rei6yYtKm2ROE7HbXg2JRXjewkgcCWEkcKWVCdJ |
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 Utils = helpersUtils.Utils; | |
var Library = helpersUtils.Library; | |
var Dates = helpersUtils.Dates; | |
var HTML = helpersUtils.Html; | |
Handlebars.registerHelper('first', function (array, count) { | |
if (!Utils.isUndefined(array)) { | |
array = Utils.result(array); | |
if (!Utils.isUndefined(count)) { | |
count = parseFloat(Utils.result(count)); |
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
NavigationView = require 'views/navigation.coffee' | |
HomeView = require 'views/home.coffee' | |
OtherView = require 'views/other.coffee' | |
LogoutView = require 'views/logout.coffee' | |
ListView = require 'views/list/index.coffee' | |
TableView = require 'views/table/index.coffee' | |
ListCollection = require 'collections/list.coffee' | |
TableCollection = require 'collections/table.coffee' | |
module.exports = Marionette.Controller.extend |
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
Controller = require 'controller.coffee' | |
Router = require 'router.coffee' | |
Components = require 'components/index.coffee' | |
require 'handlebars/helpers/index.coffee' | |
module.exports = App = new Marionette.Application() | |
App.addRegions | |
header: '#header-region' | |
main: '#main-region' |
OlderNewer