This file contains hidden or 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 adapters = { | |
redis: RedisJobQueue, | |
foo: FooJobQueue, | |
bar: BarJobQueue | |
}; | |
function JobQueueConnector(settings) { | |
this.DataAccessObject = adapters[settings.type]; | |
} |
This file contains hidden or 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
/** | |
* Dependencies | |
*/ | |
var request = require('request'); | |
var loopback = require('loopback'); | |
var app = loopback(); | |
var memoryDataSource = loopback.memory(); | |
var HEADER_NAME = 'x-access-token'; // subject to change |
This file contains hidden or 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
ast |
This file contains hidden or 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
/** | |
* First `sn install node-markdown shelljs` | |
* Then `sn markdown-example.js` | |
*/ | |
var md = require('node-markdown').Markdown | |
require('shelljs/global'); | |
/** | |
* Output the sample file as html |
This file contains hidden or 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
// the way you want to do it | |
var files = []; | |
function recurse(dir) { | |
dir.forEach(function (f) { | |
if(stat(f).isFile()) { | |
files.push(f); | |
} else { | |
recurse(fs.readdir(dir)); | |
} |
This file contains hidden or 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
// based on an example by @mikeal | |
var http = require('http') | |
, domain = require('domain') | |
; | |
module.exports = function (handler) { | |
var server = http.createServer(function (req, resp) { | |
var d = domain.create() | |
This file contains hidden or 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
// /students collection | |
// grades automatic property | |
var student = this | |
, query = { | |
courseId: { | |
$in: student.courses | |
} | |
}; | |
dpd.assignments.average('grade', query, function (avgGrade) { |
This file contains hidden or 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
fail |
This file contains hidden or 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 must be in your project's node_modules folder to be available from the dashboard | |
var Resource = require('deployd/lib/resource') | |
, util = require('util'); | |
function CrossOrigin() { | |
Resource.apply(this, arguments); | |
// match all urls when routing | |
this.path = '/*'; | |
} |