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
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Lab Automated API", | |
"version": "1.0.0-beta" | |
}, | |
"host": "lab-api.nowsecure.com", | |
"schemes": [ | |
"https" | |
], |
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
// when defined in js json-schema doesn't need no quoted keys | |
// and you can can use the native type classes if you don't have any options | |
var Person = { | |
// properties and validations | |
properties: { | |
{ id: {type: "number", unique:true, nullable:false }, | |
{ email:String, unique:true, nullable:false, minimumValue:1, maximumValue:55, pattern: '[a-b]' }, | |
{ salt: String }, | |
{ pswd: String }, |
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
// clip from media handler/serializer | |
//load the template, should return a promise from the compile() method | |
if (response.status > 400) { | |
//print("Error Response: " + response.status); | |
template = templateEngine.compile("/error/"+response.status); | |
}else{ | |
template = templateEngine.compile(templateId, (mediaParams && mediaParams.template)); | |
} | |
//when we get the template function back, execute it which returns the rendered html |
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
//load the template, should return a promise from the compile() method | |
if (response.status > 400) { | |
//print("Error Response: " + response.status); | |
template = templateEngine.compile("/error/"+response.status); | |
}else{ | |
template = templateEngine.compile(templateId, (mediaParams && mediaParams.template)); | |
} | |
//when we get the template function back, execute it which returns the rendered html | |
// i've tried a bunch of different ways to do this, but i'm not sure what should be happening in the when here |
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
// 1: how could you rewrite the following to make it shorter? | |
foo ? bar.doSomething(el) : bar.doSomethingElse(el); | |
// 2: what is the faulty logic in the following code? | |
var foo = 'hello'; | |
(function() { |
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 module provides querying functionality | |
*/ | |
exports.jsonQueryCompatible = true; | |
var operatorMap = { | |
"=": "eq", | |
"==": "eq", | |
">": "gt", | |
">=": "ge", |
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
"a!=aaa" is sugar for (identical to) "a.ne(aaa)" parses to: | |
[{ | |
property:"a", | |
operator:"ne", | |
values: ["aaa"] | |
}] | |
"a=aaa" is sugar for (identical to) "a.eq(aaa)" parses to: |
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
// exports defined out here. | |
exports.foo = "bar" | |
require( | |
{sys: "sys", File: "file", sqlite: "persistence/sqlite3"} | |
)(function () { | |
sys.p(File); | |
// Rest of program here | |
}); |