Skip to content

Instantly share code, notes, and snippets.

Matt Burke spraints

View GitHub Profile
View is_nil_really_nil.go
package main
import (
"fmt"
)
func main() {
try(&Owner{})
try(&Owner{org: &Organization{"group"}})
try(&Owner{user: &User{"person"}})
View Gemfile
source "https://rubygems.org"
gem "mochilo", :git => "https://github.com/spraints/mochilo", :ref => "custom-type-registry"
gem "benchmark-ips"
@spraints
spraints / go.command
Last active Apr 13, 2017
Stitch a folder of images into a movie
View go.command
#!/bin/bash
root=$(cd $(dirname "$0"); pwd)
cd $root
exec ruby process.rb "$@"
@spraints
spraints / bench-init.rb
Created Oct 5, 2016
benchmark a few styles of constructors in ruby
View bench-init.rb
# I wanted to see how fast different constructor styles were.
#
# Calculating -------------------------------------
# splat 73.970k i/100ms
# manual splat 77.512k i/100ms
# kwarg 23.687k i/100ms
# attr 77.930k i/100ms
# opts 34.173k i/100ms
# fetch 29.289k i/100ms
# -------------------------------------------------
@spraints
spraints / .gitignore
Last active Aug 20, 2016
farmersmarket.com helpers
View ssh_tunnel_for_docker.md

I wanted to connect from a docker container on a prod server to an SVN server on my laptop today. The steps were tricky, so here they are:

ssh tunnel

Exposing the local port to the prod server is pretty straightforward

laptop$ ssh -R 4204:127.0.0.1:4204 myserver

docker networking

View blink.rb
View 00-README.md

Terminal 1:

ruby 01-build-repo.rb test.git
ruby 02b-read-refs.rb test.git

Terminal 2:

View farmhacks.md
You can’t perform that action at this time.