Skip to content

Instantly share code, notes, and snippets.

View groveriffic's full-sized avatar

Sam Ehlers groveriffic

View GitHub Profile
@groveriffic
groveriffic / external_services_snippet_spec.rb
Created March 5, 2014 20:42
This automatically disables specs when the url is not specified via environment variable.
let(:ftp_url) {
if ENV['FTP_TEST_URL']
URI(ENV['FTP_TEST_URL'])
else
pending "Set ENV['FTP_TEST_URL'] to enable"
end
}
@groveriffic
groveriffic / consumer.rb
Created April 22, 2014 21:59
Basically 'cat' over AMQP to demonstrate exchanges and routing keys
require 'rubygems'
require 'bundler'
Bundler.require(:default)
Bunny.run(ENV['AMQP_URL']) do |conn|
routing_key = 'test.demonstration'
conn.with_channel do |ch|
queue = ch.queue('composinator.test.demonstration')
exchange = ch.direct('composinator')

Keybase proof

I hereby claim:

  • I am groveriffic on github.
  • I am groveriffic (https://keybase.io/groveriffic) on keybase.
  • I have a public key whose fingerprint is D2BE D5ED DAF4 7485 A60C 63B1 FE4C 0459 2039 63AA

To claim this, I am signing this object:

package ids
import (
"fmt"
"testing"
"testing/quick"
)
func ExampleMarshalString() {
fmt.Print("\n")
@groveriffic
groveriffic / .vimrc
Created April 4, 2012 18:48
My Vimrc
set wildmode=list,longest
if has("gui_running")
colorscheme darkblue
set guifont=Bitstream\ Vera\ Sans\ Mono\ Bold:h13
set guioptions-=T
endif
if has("gui_macvim")
class MetaDerp
### DENSE HORRIBLE CODE
# This should be broken up into smaller chunks possibly moved out into a mixin
# to hide it's horribleness
class << self
def hunt(name, *keys)
class_eval %[
def #{name}
#{keys.map{|key| "row[#{key.inspect}]" }.join(' || ')}
end
@groveriffic
groveriffic / sum_monoid.go
Last active October 15, 2015 20:22
Demonstrates a trivial sum monoid in Go.
package main
import (
"fmt"
"log"
)
// Sum monoid
var identity int = 0
var mappend = func(a, b int) int {
package main
import (
"fmt"
"log"
)
// Product monoid
var identity int = 1
var mappend = func(a, b int) int {
package main
import (
"fmt"
"log"
)
// A monoid that combines sum and count to calculate an average
type average struct {
sum int
package main
import (
"fmt"
"log"
)
// String Concatenation Monoid
var identity string = ""
var mappend = func(a, b string) string {