TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| const http = require('http'); | |
| const WebSocket = require('ws'); | |
| const server = http.createServer(); | |
| const wss = new WebSocket.Server({ server }); | |
| wss.on('connection', function connection(ws, req) { | |
| console.log('Incoming connection from %s', req.connection.remoteAddress); | |
| clients.push(ws); | |
| ws.on('close', function() { | |
| console.log('%s disconnected', ws._socket.remoteAddress); | |
| const id = clients.indexOf(ws); |
| const net = require('net'); | |
| const clients = []; | |
| function handleConnection(conn) { | |
| function onConnData(d) { | |
| const decoder = new StringDecoder(); | |
| // Decode received string | |
| const stream = decoder.write(d); | |
| try { | |
| splitJson(stream).forEach((str) => clients.forEach((client) => client.send(str))); |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| require "rspec/expectations" | |
| require "hashdiff" | |
| require "terminal-table" | |
| RSpec::Matchers.define :eq_hash do |expected| | |
| match do |actual| | |
| HashDiff.diff(expected, actual).empty? | |
| end | |
| failure_message do |actual| | |
| diff = HashDiff.diff(expected, actual) |
| class String | |
| def to_bool | |
| return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
| return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
| raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
| end | |
| end |
| module WhinyMonday | |
| def included(mod) | |
| mod.instance_methods.each {|m| mod.send(:remove_method,m)} | |
| end | |
| def method_missing(symbol, *args) | |
| puts "On Monday, I don't #{symbol}" | |
| end | |
| end |