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
| #!/usr/bin/env node | |
| var env = require('./env'); | |
| var cfg = env.cfg; | |
| var cp = require('child_process'); | |
| var fs = require('fs'); | |
| var path = require('path'); | |
| var processes = []; |
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
| function runAfter(times, func) { | |
| if (times <= 0) return func(); | |
| return function() { | |
| if (--times < 1) { return func.apply(this, arguments); } | |
| }; | |
| }; |
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
| query = resource-type, [fields], [condition]; | |
| resource-type = string; | |
| fields = "(", string, [",", {string}], ")"; | |
| condition = ":" , (integer, "..", integer) | |
| | (integer, "_", positive-integer) | |
| | integer | |
| | string | |
| | ("~", integer) | |
| | "*"; | |
| string = alphanumerical, { char }; |
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 purity = require('virtue-purity'); //virtue's validation | |
| //& sanitization lib. | |
| var user = { | |
| name : [ purity.isString ], //Simple validation that the | |
| //name is a string. | |
| email : [ purity.trim, purity.isString, purity.isEmail ], |
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
| authmethods : [ | |
| { type: 'facebook', | |
| id: '12304912835812304192384' | |
| token : 'asd0fa0sd9fasjdlfasdf9as0d98fasd', | |
| salt: '1029384as0d9fasd8fasdf09asdf8as0df9as8dfasdf0asd9', | |
| data: {...} | |
| }, | |
| { | |
| type: 'password', |
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
| function findMostRecent(folder){ | |
| var mostRecent = null | |
| var contentList = getFolderContentList(folder.path); | |
| for(var i = 0; i < contentList.length; ++i){ | |
| if(contentList[i].type === 'file' && | |
| (mostRecent === null || contentList[i].date > mostRecent.date)){ | |
| mostRecent = contentList[i]; |
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 user = { | |
| name : [ purity.isString ], //Simple validation that the | |
| //name is a string. | |
| email : [ purity.trim, purity.isString, purity.isEmail ], | |
| age : [ purity.isNumber, purity.greater(0), purity.toInt ], | |
| //Array of friends |
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 validation = require( './validation' ); | |
| var v = require('./validators' ); | |
| function lowerCase( value, err ){ | |
| return value.toLowerCase(); | |
| } | |
| var userSchema = { | |
| firstname : [ v.trim() ], | |
| lastname : [ v.trim() ], |
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
| { | |
| file: < the file> | |
| name: filename | |
| hook: { | |
| name : "user_avatar", | |
| userid : "09a8019238402a9sdfsa0", | |
| } | |
| } |