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 express = require('express'); | |
| var mongoose = require('mongoose'); | |
| var error = require('http-errors'); | |
| require('./posts'); | |
| var api = express(); | |
| api.get('/:collection', (req, res, next) => { | |
| let Model = getModel(req); | |
| Model.access({ |
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
| 'use strict'; | |
| var net = require('net'); | |
| var multilevel = require('multilevel'); | |
| var level = require('level'); | |
| var db = level('db'); | |
| var server = net.createServer(con => { | |
| con.pipe(multilevel.server(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
| server { # simple reverse-proxy | |
| server_name _; | |
| listen 80 default_server; | |
| location / { | |
| proxy_pass http://app:5984; | |
| proxy_redirect off; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } |
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 klaemo/couchdb:1.6 | |
| RUN apt-get update -y \ | |
| && apt-get install -y --no-install-recommends \ | |
| python build-essential git-core | |
| # gpg keys listed at https://github.com/nodejs/node | |
| RUN set -ex \ | |
| && for key in \ | |
| 9554F04D7259F04124DE6B476D5A82AC7E37093B \ |
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
| // Example for a reactive functional router implemented in highland. | |
| var router = _.pipeline( | |
| _.map(e => (parse(e.newURL).hash || '#').slice(1)), | |
| _.map(path => routes.match(path)), | |
| _.map(m => m.fn(m.params)), | |
| // Make sure that the side-effect results are resetted. | |
| _.flatMap(m => _([ | |
| {_location: window.location.hash, _view: null} |
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
| private Bitmap rotateBitmap(Bitmap source, byte[] data) { | |
| int exifOffset = Exif.getOrientation(data); | |
| int rotation = this.rotation; | |
| int rotate = 0; | |
| if ((rotation < (270 + 45) && rotation > (270 - 45))) { | |
| Log.e("BLIMP", "270 degrees ..."); | |
| rotate = -90; | |
| } else if (rotation < (90 + 45) && rotation > (90 - 45)) { | |
| Log.e("BLIMP", "90 degrees ..."); |
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
| ### | |
| Lazy load an object. | |
| ### | |
| req.object = (type, id, fn) -> | |
| if typeof id is 'function' | |
| fn = id | |
| id = null | |
| unless id? | |
| object = new _Object( | |
| website: req.website._id |
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
| docker-compose up -d | |
| docker attach myapp_web_1 |
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
| docker-compose run --rm web rails console |
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
| docker-compose run --rm web bundle install --path vendor/bundle |