Skip to content

Instantly share code, notes, and snippets.

package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@crucialfelix
crucialfelix / angular-speedball.js
Last active August 29, 2015 14:06
Angular Speedball - a jasmine testing utility to eliminate boilerplate in testing
'use strict';
/**
*
* An Angular Jasmine testing utility
*
* @copyright 2013 Chris Sattinger
* MIT License
*
* automatically injects these services:
* '$httpBackend', '$rootScope', '$controller', '$compile'
@larskanis
larskanis / pg_log_unable_to_send.rb
Last active June 20, 2022 13:36
Monkey patch PG::Connection to get more a descriptive error message
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
@carymrobbins
carymrobbins / setup-postgresql-vagrant.md
Last active May 4, 2023 10:22
Configure PostgreSQL in a Vagrant guest to allow connections from the host.

Configure Postgres

  • 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

package main
import (
"fmt"
"reflect"
"net/url"
)
type ExampleType struct {
Name string `url:"name"`
# 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