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 arg = _.partial(_.includes, process.argv.slice(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
dust.helpers.mon = function(chunk, ctx, bodies, params) { | |
return chunk.map(function(chunk) { | |
var m = params.name; | |
if (!m || !models[m]) return chunk.write('No such model').end(); | |
models[m].findOne().exec(function(err, doc) { | |
if (err) return chunk.write(err).end(); | |
chunk.render(bodies.block, ctx.push(doc)).end(); | |
}); | |
}); |
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
rivets.binders['on-valid'] = { | |
'function': true, | |
unbind: function(el) { | |
$(el).data('validator', null) | |
.unbind('validate'); | |
}, | |
routine: function(el, value) { | |
var handler = this.handler = this.eventHandler(value); | |
return $(el) | |
.on('submit', function() { return false; }) |
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() { | |
'use strict'; | |
window.hash = { | |
add: function(p) { | |
if (-1 == window.location.hash.indexOf(p)) | |
window.location.hash += p + ','; | |
}, | |
remove: function(p) { | |
window.location.hash = window.location.hash.replace(p + ',', ''); |
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
dust.helpers.first = function(chunk, context, bodies) { | |
if (context.stack.index == 0) | |
return chunk.render(bodies.block, context); | |
else if (bodies['else']) | |
return chunk.render(bodies['else'], context); | |
else | |
return chunk; | |
}; |
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
/**package | |
{ | |
"name": "mailson", | |
"description": "Mailing for kids", | |
"version": "0.1.0", | |
"author": { | |
"name": "Etay Perez", | |
"email": "etai@empeeric.com" | |
}, | |
"dependencies": { |
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
// add class, remove it at animation end. also callback | |
$.fn.animateClass = function(cls, cb) { | |
if (typeof cb === 'string') { | |
var endClass = cb; | |
cb = function() { $(this).addClass(endClass); }; | |
} | |
return $(this).one('webkitAnimationEnd', function() { | |
$(this).removeClass(cls); | |
if (cb) cb.call(this); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<TaskOptions> | |
<TaskOptions> | |
<option name="arguments" value="C:\projects\Sentr\server\compile_templates.js" /> | |
<option name="checkSyntaxErrors" value="true" /> | |
<option name="description" value="" /> | |
<option name="exitCodeBehavior" value="ERROR" /> | |
<option name="fileExtension" value="tl" /> | |
<option name="immediateSync" value="true" /> | |
<option name="name" value="dust templates" /> |
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
/* | |
$('form').serializeObject() get form data as an object | |
$('form').formJSON(callback) send form as ajax | |
example: | |
$('form[data-json]').formJSON(function(res) { | |
$('h3.message').text(res.message); | |
}); | |
*/ |
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
// fit element contents to its width | |
(function($) { | |
$.fn.fitter = function() { | |
this.each(function() { | |
var el = $(this).css({ | |
//'overflow-x': 'hidden', | |
'white-space': 'nowrap' | |
}), | |
fitter = el.wrapInner('<fitter />').children('fitter').css({ | |
display: 'inline-block' |