View list-mantri.js
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 mantri = require('mantri'); | |
var mantriCompile = require('mantri/lib/mantri-build-compile'); | |
mantriCompile.getDepsFiles({ | |
jsRoot: './js', | |
src: './js/app.js', | |
gmockDir: mantri.helpers.getPath('closure-mock'), | |
}, function(status, results) { | |
console.log('Status should be true:', status); |
View test.js
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
test('test case', function(done) { | |
promise.method(function(result) { | |
assert.equal(result.name, 'mocha'); | |
}).then(done, done); | |
}); |
View apitest.js
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 apitest = module.exports = {}; | |
/** | |
* Have a Cooldown period between tests. | |
* | |
* @param {number} seconds cooldown in seconds. | |
* @return {Function} use is beforeEach(). | |
*/ | |
apitest.cooldown = function(seconds) { | |
return function(done) { |
View Gruntfie.js
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
module.exports = function (grunt) { | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
express: { | |
options: { | |
// Override defaults here | |
}, | |
web: { | |
options: { |
View doodle.js
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 retProm() { | |
var def = when.defer(); | |
return def.resolve(); | |
} | |
console.log('one'); | |
retProm().then(function(){console.log('two')); | |
console.log('three'); |
View Gruntfile.js
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
module.exports = function (grunt) { | |
grunt.initConfig({ | |
watch: { | |
options: { | |
livereload: true | |
}, | |
// triggering livereload when the .css file is updated | |
// (compared to triggering when sass completes) | |
// allows livereload to not do a full page refresh | |
styles: { |
View perf.js
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 PerfTime = require('perf-time'); | |
//var _ = require('underscore'); | |
var Perf = module.exports = function() { | |
this.startTime = null; | |
// this.t = new PerfTime(); | |
this.t = { | |
get: function() { | |
return Date.now(); | |
} |
View test.js
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 assert = require('chai').assert; | |
var when = require('when'); | |
var def1 = when.defer(); | |
function getProm() { | |
return def1.promise; | |
} |
View app.js
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
// calling multiple callbacks for a promise | |
var promise = fnReturnsPromise(); | |
promise.then(fn1); | |
promise.then(fn2); | |
// that is not the same ? | |
fnReturnsPromise().then(fn1).then(fn2); | |
View Gruntfile.js
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
module.exports = function (grunt) { | |
multiTask: { | |
options: { | |
anObject: { | |
a: 1 | |
} | |
}, | |
target: { | |
options: { | |
anObject: { |