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
Handlebars.registerHelper('sum', function() { | |
var args = _.flatten(arguments); | |
var sum = 0; | |
var i = args.length - 1; | |
while (i--) { | |
sum += _.parseInt(args[i]) || 0; | |
} | |
return Number(sum); | |
}); |
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
ensureModules = (app, modules) -> | |
_.each app.submodules, (module) -> | |
if (modules.indexOf(module.moduleName) == -1 && module.started) | |
console.log 'stopping module:', module.moduleName | |
module.stop() | |
_.each(app.submodules, (module) -> | |
if (modules.indexOf(module.moduleName) > -1 && !module.started) | |
console.log 'starting module:', module.moduleName |
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
$(document).ajaxError(function(evt, xhr, options) { | |
var responseText = xhr.responseText || 'The server did not respond on time.'; | |
var status = xhr.status || 408; | |
var statusText = xhr.statusText || 'Request Timeout'; | |
var message = { | |
text: responseText, | |
code: status, | |
url: xhr.url, | |
status: statusText |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Front-end Boilerplate</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<link rel="icon" href="favicon.ico"> | |
</head> | |
<body> | |
<script id="list-item-template" type="text/x-handlebars-template"> |
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 App = new Marionette.Application({ | |
regions: { | |
'detail': '#detail' | |
} | |
}); | |
var doc1 = { | |
"_id": "123", | |
"type": "customer", | |
"datosGenerales": { |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script> |
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 1 | |
class AppRouter extends Mn.AppRouter | |
appRoutes: | |
'': DefaultRoute | |
module.exports = new AppRouter | |
# example 2 | |
module.exports = new Mn.AppRouter | |
appRoutes: |
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
$.load('/' + id, function(reseponseText) { | |
$('#main').html(responseText); | |
$('#main').trigger('create'); // (no recuerdo 100% si era asi esta linea suya.) | |
}); |
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
Backbone.history.start({ pushState: true }); | |
$(document).on('click', 'a:not([data-bypass])', function (evt) { | |
var href = $(this).attr('href'); | |
var protocol = this.protocol + '//'; | |
if (href.slice(protocol.length) !== protocol) { | |
evt.preventDefault(); | |
app.router.navigate(href, true); | |
} |
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
myArray = [] | |
_id = 'e427a9b6-328c-4b95-a6e3-421ab74d5163' | |
key = "bpm.processes." + _id | |
obj = {} | |
obj[key] = 'b4503eb5-7e8b-44da-bca1-73735bd3a92a'; | |
myArray[0] = {'root': true} | |
myArray.push(obj) | |
query = {}; | |
query['$and'] = myArray | |
console.log JSON.stringify(query) |