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
| // usage: promisify(function([args..., cb]) { /* do stuff with args then cb */ })() | |
| exports.promisify = function(fn) { | |
| return function(...args) { | |
| return new Promise((resolve, reject) => { | |
| fn(...args, (err, result) => { | |
| if (err) return reject(err); | |
| resolve(result); | |
| }); | |
| }); | |
| }; |
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
| local key = KEYS[1] | |
| local args = ARGV | |
| local call = redis.call | |
| if call("EXISTS", key) == 0 then | |
| return nil | |
| end | |
| return call("HMSET", key, unpack(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
| /** | |
| * npm install --save lodash redis node-redis-scripty | |
| * | |
| * Usage: | |
| * let hmsetex = require('./hmsetex.js') | |
| * let key = 'your-key'; | |
| * let fields = { some_field: 'test', another_field: 'foo' }; | |
| * hmsetex(key, fields).then(handleResult).catch(handleError); | |
| */ | |
| const _ = require('lodash'); |
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
| FROM mhart/alpine-node:8.9.1 | |
| ADD . /app | |
| WORKDIR /app | |
| RUN apk --no-cache add python make gcc g++ git; \ | |
| npm install; \ | |
| apk --purge del python make gcc g++; | |
| ENTRYPOINT [ "node" ] |
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
| # App ship-it stack with ECS, CodeBuild & CodePipeline. | |
| # | |
| # aws cloudformation deploy \ | |
| # --stack-name myapp-prod \ | |
| # --template-file ./aws-ship-it-stack.yaml \ | |
| # --parameter-overrides \ | |
| # KeyName=<KEY_NAME> \ | |
| # GitHubAuthToken=<ACCESS_TOKEN> \ | |
| # RepoOwner=<OWNER_NAME> \ | |
| # RepoName=<REPO_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
| # Stack to create EC2 instances for ECS cluster. | |
| # | |
| # aws cloudformation deploy \ | |
| # --stack-name app-cluster-prod \ | |
| # --template-file ./aws-cluster-stack.yaml \ | |
| # --parameter-overrides \ | |
| # KeyName=DEFAULT \ | |
| # SecurityGroups=group1,group2 \ | |
| # ImageId=ami-123456 \ | |
| # InstanceType=c5.large \ |
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
| version: 0.1 | |
| phases: | |
| pre_build: | |
| commands: | |
| - $(aws ecr get-login --region $AWS_REGION) | |
| - pip install docker-compose | |
| build: | |
| commands: | |
| - docker build -t $APP_IMAGE . |
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
| FROM mhart/alpine-node:8.9.3 | |
| ADD . /app | |
| WORKDIR /app | |
| RUN apk --no-cache add python make gcc g++ git; \ | |
| npm install; \ | |
| apk --purge del python make gcc g++; | |
| CMD [ "node", "src/main" ] |
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
| test: | |
| image: "${APP_IMAGE}" | |
| links: | |
| - es | |
| - redis | |
| environment: | |
| - NODE_ENV=test | |
| - ES_HOST=es | |
| - REDIS_HOST=redis |
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 secondThing = { term: { field2: 'bar' } }; | |
| const firstThing = { term: { field1: 'foo' } }; | |
| const filter = [ firstThing, secondThing ]; | |
| const bool = { filter }; | |
| const query = { bool }; | |
| const body = { query }; | |
| const params = { | |
| index: 'your-index', | |
| body | |
| }; |