Skip to content

Instantly share code, notes, and snippets.

@domachine
domachine / index.coffee
Last active August 29, 2015 14:15
archtitect-route-registration
express = require('express')
controllers = require('./controllers/users')
app = express()
app.get '/users/new', controllers.new
@domachine
domachine / controllers_users.coffee
Created February 13, 2015 11:32
architect-controllers
mongoose = require('mongoose')
User = mongoose.model('User')
exports.new = (req, res, done) ->
user = new User()
res.render 'users/new', user: user
@domachine
domachine / architect_index.coffee
Created February 13, 2015 11:34
architect-way-route-registration
architect = require('express-resource-architect')
mongoose = require('mongoose')
resource = architect(app)
resource mongoose.model('User'), require('./controllers/users')
@domachine
domachine / architect_controllers.coffee
Created February 13, 2015 11:35
architect-way-controllers
architect = require('express-resource-architect')
c = architect.controllers()
exports.new = c.new()
@domachine
domachine / architect_middleware_example.coffee
Created February 13, 2015 11:36
architect-middleware-example
architect = require('express-resource-architect')
m = architect.middleware()
exports.new = [
m.new()
m.view 'users/new', true
]
@domachine
domachine / architect_instantiation_example.coffee
Created February 24, 2015 10:37
architect-instantiation
architect = require('architect')
express = require('express')
app = express()
instance = architect(app)
@domachine
domachine / docker-compose-bare.yml
Last active August 29, 2015 14:20
bare docker-compose.yml file without db
web:
image: ruby:2.2.2
command: bundle exec rails s -b 0.0.0.0
working_dir: /usr/src/app
volumes:
- .:/usr/src/app
ports:
- 3000:3000
environment:
GEM_PATH: /usr/src/app/vendor/bundle:/usr/local/bundle
@domachine
domachine / .bundle-config
Created April 28, 2015 09:00
docker-compose rails bundle config
---
BUNDLE_PATH: vendor/bundle
@domachine
domachine / bundle-install.sh
Created April 28, 2015 09:05
one shot container to run bundle install
docker-compose run --rm web bundle install --path vendor/bundle
@domachine
domachine / docker-compose-console.sh
Created April 28, 2015 16:27
one-shot container to run rails console
docker-compose run --rm web rails console