- Update pg_hba.conf (most likely in /etc/postgresql/9.4/main) with -
host all all 0.0.0.0/0 trust
- Update postgresql.conf to use
listen_addresses = '*'
- Be sure to
sudo service postgresql restart
Configure Vagrant
# frozen_string_literal: true | |
class SlowCall | |
def self.work | |
@work ||= Concurrent::Promises.future(name: "load #{self.class.name}") do | |
sleep 2 | |
Time.now | |
end | |
end | |
end |
require 'pg' | |
class PG::Connection | |
def self.wrap_send_method(meth) | |
alias_method "#{meth}_wo_wrap", meth | |
define_method(meth) do |*args| | |
begin | |
send("#{meth}_wo_wrap", *args) | |
rescue PG::UnableToSend => e |
'use strict'; | |
/** | |
* | |
* An Angular Jasmine testing utility | |
* | |
* @copyright 2013 Chris Sattinger | |
* MIT License | |
* | |
* automatically injects these services: | |
* '$httpBackend', '$rootScope', '$controller', '$compile' |
package main | |
import ( | |
"net/http" | |
"database/sql" | |
"fmt" | |
"log" | |
"os" | |
) |
var HEADER_NAME = 'MyApp-Handle-Errors-Generically'; | |
var specificallyHandleInProgress = false; | |
angular.module('myApp').factory('RequestsErrorHandler', ['$q', function($q) { | |
return { | |
// --- The user's API for claiming responsiblity for requests --- | |
specificallyHandled: function(specificallyHandledBlock) { | |
specificallyHandleInProgress = true; | |
try { | |
return specificallyHandledBlock(); |
/** | |
* Interceptor | |
* Implements functionality to catch various requests and fire events when they happen. This is generally to ensure | |
* that responses from the server are handled in a uniform fashion across the application. Also, by firing events | |
* it allows to have any number of handlers attach to the response. | |
* | |
* @author Kirk Bushell | |
* @date 28th March 2013 | |
*/ | |
var module = angular.module('core.interceptor', []); |
var EventSystem = (function() { | |
var self = this; | |
self.queue = {}; | |
return { | |
publish: function (event, data) { | |
var queue = self.queue[event]; | |
if (typeof queue === 'undefined') { |
# NOTE This is probably no longer needed, now DRF does this | |
# automatically if you have ATOMIC_REQUESTS enabled. | |
# https://github.com/encode/django-rest-framework/pull/2887 | |
from django.db import transaction | |
class AtomicMixin(object): | |
""" | |
Ensures we rollback db transactions on exceptions. |