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
| ################## Installing Docker ################## | |
| # https://docs.docker.com/installation/ubuntulinux/ | |
| curl -sSL https://get.docker.com/ubuntu/ | sudo sh | |
| #### Configuring docker to run without sudo | |
| # http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo | |
| ## Add the docker group if it doesn't already exist. | |
| sudo groupadd docker | |
| ## Add the connected user "${USER}" to the docker group. Change the user name to match your preferred user. |
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
| sudo apt-get -y install git-flow | |
| npm install -g mocha gulp gg ungit | |
| sudo apt-get -y install zsh | |
| sed -i "s/alias gg='git gui citool'/alias ggg='git gui citool'/g" ~/.oh-my-zsh/plugins/git/git.plugin.zsh | |
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 gulp = require('gulp'); | |
| gulp.task('mongo-eval', function() { | |
| var Db = require('mongodb').Db, | |
| Server = require('mongodb').Server, | |
| assert = require('assert'); | |
| var db = new Db('local', new Server('localhost', 27017)); | |
| // Establish connection to db | |
| db.open(function(err, db) { |
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
| @Grab('com.github.fge:json-schema-validator:2.2.6') | |
| @Grab('com.sparkjava:spark-core:2.1') | |
| import spark.* | |
| import static spark.Spark.* | |
| import com.github.fge.jackson.JsonLoader | |
| import com.github.fge.jsonschema.main.JsonSchemaFactory | |
| def factory = JsonSchemaFactory.byDefault() |
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
| import groovy.text.SimpleTemplateEngine | |
| def rawTemplate = '''CREATE OR REPLACE TRIGGER ${owner}.${entityName}_INSERT | |
| AFTER INSERT | |
| ON ${owner}.${tableName} | |
| WHEN | |
| ${ columns.collect( { " old.$it <> new.$it" } ).join(/\n/) } | |
| BEGIN | |
| END''' |
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
| def defineRoute(routeBuilder) { | |
| routeBuilder.categories { | |
| schema { | |
| properties { | |
| name { | |
| type string, | |
| description "a name" | |
| } | |
| links { | |
| brand "brands" |
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
| def defineRoute(routeBuilder) { | |
| // defining a "categories" endpoint | |
| routeBuilder."/categories" { | |
| // defining the "Category" schema | |
| schema Category { | |
| properties { | |
| // this is pure jsonschema, with a builder syntax | |
| name { | |
| type string | |
| description "a name" |
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
| // ---------------------------------------------- | |
| // Builder implementation and supporting classes. | |
| // ---------------------------------------------- | |
| import groovy.transform.* | |
| @Canonical | |
| class Definition { | |
| Map<String, Schema> schemas = [:] | |
| def methodMissing(String name, args) { |
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
| resource.definitions.Comment { | |
| properties { | |
| id { | |
| type 'Integer' | |
| description 'The comment id' | |
| } | |
| name { | |
| type 'String' | |
| description 'The comment name' | |
| } |
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
| class CommentResourceBuilder { | |
| def buildResource(Resource resource) { | |
| resource.definitions = | |
| resource.definitions | |
| .Comments { | |
| properties { | |
| body { | |
| type 'string' | |
| description 'Comments contents' | |
| } |