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
| /* refs: | |
| * http://oli.me.uk/2013/06/01/prototypical-inheritance-done-right/ | |
| * http://davidshariff.com/blog/javascript-inheritance-patterns/ | |
| */ | |
| "use strict"; | |
| function Human(name, gender) { | |
| this.name = name; | |
| this.gender = gender; | |
| } |
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
| package tests | |
| import static groovy.json.JsonOutput.* | |
| import static org.junit.Assert.* | |
| import geb.Browser | |
| import java.util.concurrent.* | |
| import org.junit.Before | |
| import org.junit.Test |
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
| swagger: '2.0' | |
| info: | |
| version: '1.0.0' | |
| title: Swagger Petstore (Simple) | |
| description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification | |
| termsOfService: http://helloreverb.com/terms/ | |
| contact: | |
| name: Swagger API team | |
| email: [email protected] | |
| url: http://swagger.io |
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 allChoices = []; | |
| _.each(iceCreamChoices, function(ic) { | |
| _.each(toppingChoices, function(tp) { | |
| _.each(syrupChoices, function(sy) { | |
| allChoices.push([ic,tp,sy]); | |
| }) | |
| }) | |
| }) |
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 count = 0; | |
| _.each(iceCreamChoices, function(ic) { | |
| _.each(toppingChoices, function(tp) { | |
| _.each(syrupChoices, function(sy) { | |
| //allChoices.push([ic,tp,sy]); | |
| db.post({choice: [ic,tp,sy]}, function(err, doc){ | |
| if (err) console.error(err); | |
| else console.log(`stored ${++count}`); | |
| }); |
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 run() { | |
| var menu = { //... | |
| } | |
| var iceCreamChoices = new Combinator({ //... | |
| }); | |
| var toppingChoices = new Combinator({ //... | |
| }); | |
| var syrupChoices = new Combinator({ //... | |
| }); |
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 _ = require('lodash'); | |
| var PouchDB = require('pouchdb'); | |
| var db = new PouchDB('choices'); | |
| db.allDocs({ | |
| include_docs: true | |
| }) | |
| .then(docs => { | |
| _.each(docs.rows, r => { |
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
| const crypto = require('crypto'); | |
| const _ = require('lodash') | |
| function hash(choice) { | |
| var str = _.chain(choice) | |
| .flatten() | |
| .sortBy() | |
| .join('|') | |
| .value(); |
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
| const _ = require('lodash'); | |
| const hash = require('./hash'); | |
| const PouchDB = require('pouchdb'); | |
| const db = new PouchDB('choices'); | |
| db.allDocs({ | |
| include_docs: true | |
| }) | |
| .then(docs => { |
OlderNewer