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
/* | |
* This binds the node-validator library to the req object so that | |
* the validation / sanitization methods can be called on parameter | |
* names rather than the actual strings. | |
* | |
* 1. Be sure to include `req.mixinParams()` as middleware to merge | |
* query string, body and named parameters into `req.params` | |
* | |
* 2. To validate parameters, use `req.check(param_name, [err_message])` | |
* e.g. req.check('param1').len(1, 6).isInt(); |
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 async = require('async'), | |
assert = require('assert'); | |
// Clean up database | |
function cleanUp(Model, callback) { | |
Model.remove({}, function(err) { | |
Model.find({}, function(err, docs) { | |
assert.equal(docs.length, 0, 'Documents should not exist, found ' + docs.length); | |
callback(err); | |
}); |
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 async = require('async'), | |
assert = require('assert'); | |
// Clean up database | |
function cleanUp(Model, callback) { | |
Model.remove({}, function(err) { | |
Model.find({}, function(err, docs) { | |
assert.equal(docs.length, 0, 'Documents should not exist, found ' + | |
docs.length); | |
callback(err); |
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
// Loads fixtures using given data, and executes callback | |
// | |
// The fixutres are loaded in recursive callbacks from the documents' save | |
// methods, therefore the loadFixtures call is asynchronous itself, even though | |
// it will load documents serially. | |
// | |
// When using loadFixtues in testing, you need to keep above in mind. Running | |
// multiple tests that use loadFixtures one after another _will_ cause trouble. | |
// | |
// The callback function is passed data that has been entered into the |
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 fs = require('fs'), | |
path = require('path'), | |
nodemailer = require('nodemailer'), | |
template = require('template'), | |
cache = {}, | |
config = require('../config'); | |
function MailerError(msg) { | |
this.msg = msg; | |
} |
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
""" https://bitbucket.org/brankovukelic/pyproto """ | |
from copy import copy | |
__all__ = ['Object'] | |
class Object(object): | |
"""Base prototype for prototypal object model in Python | |
To create a new object, simply instantiate an Object instance:: |
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
###! | |
Router | |
====== | |
@author Branko Vukelic <[email protected]> | |
@license MIT | |
@version 0.0.1 | |
### | |
### |
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
define = ((root) -> | |
if typeof root.define isnt 'function' or not root.define.amd | |
if GLOBAL? and typeof module is 'object' and module.exports | |
(factory) -> | |
module.exports = factory(GLOBAL.require) | |
else | |
require = (dep) -> | |
(() => | |
switch dep | |
when 'underscore' then @_ |
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
propset: (o, p, v=null) -> | |
[f, r...] = p.split('.') | |
if not f of o | |
o[f] = if not r.length then v else {} | |
h.propset o[f], r.join '.', v |
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
start on runlevel [2345] | |
stop on runlevel [06] | |
exec /path/to/start.sh |
OlderNewer