Skip to content

Instantly share code, notes, and snippets.

View deanlandolt's full-sized avatar

Dean Landolt deanlandolt

  • NowSecure
  • Washington, DC
View GitHub Profile
{
"swagger": "2.0",
"info": {
"title": "Lab Automated API",
"version": "1.0.0-beta"
},
"host": "lab-api.nowsecure.com",
"schemes": [
"https"
],
// 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 },
// 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
//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
// 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 module provides querying functionality
*/
exports.jsonQueryCompatible = true;
var operatorMap = {
"=": "eq",
"==": "eq",
">": "gt",
">=": "ge",
"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:
// exports defined out here.
exports.foo = "bar"
require(
{sys: "sys", File: "file", sqlite: "persistence/sqlite3"}
)(function () {
sys.p(File);
// Rest of program here
});