Skip to content

Instantly share code, notes, and snippets.

@ebaizel
ebaizel / seats.js
Last active August 29, 2015 14:01
Given 100 chairs, keep one and skip the next. Repeat till only one chair remains.
var Seat = function(number) {
this.occupied = true;
this.number = number;
}
var seats = [];
(function setup() {
for (var i=0; i < 100; i++) {
seats[i] = new Seat(i+1);
[05/08 13:32:26 PDT][out] Express server listening on port 80 in production mode
[05/08 13:32:26 PDT][err] events.js:72
[05/08 13:32:26 PDT][err] Error: bind EADDRINUSE
[05/08 13:32:26 PDT][err] at errnoException (net.js:904:11)
[05/08 13:32:26 PDT][err] at net.js:1084:30
[05/08 13:32:26 PDT][err] at Object.1323:1 (cluster.js:592:5)
[05/08 13:32:26 PDT][err] at handleResponse (cluster.js:171:41)
[05/08 13:32:26 PDT][err] at respond (cluster.js:192:5)
[05/08 13:32:26 PDT][err] at handleMessage (cluster.js:202:5)
[05/08 13:32:26 PDT][err] at process.EventEmitter.emit (events.js:117:20)
mongoose = require('mongoose')
Schema = mongoose.Schema
artistSchema = require('../models2').artistSchema
models = require('../models2')
module.exports = (app) ->
getDB = ->
db = mongoose.createConnection(app.get('dburi'))
db.on 'error', console.error.bind(console, 'connection error:')