Skip to content

Instantly share code, notes, and snippets.

View dmann's full-sized avatar

Darrin Mann dmann

  • Duke Univeristy
  • Durham, NC
View GitHub Profile
@dmann
dmann / factory_doctor.rb
Last active August 1, 2017 13:37 — forked from palkan/factory_doctor.rb
FactoryDoc: detect useless data generation in tests
# - Add it into 'spec/support/factory_doctor.rb`
# - require 'support/factory_doctor' into rails_helper.rb
# - Run it with FDOC=1 rspec
module FactoryGirl
module Doctor
module FloatDuration
refine Float do
def duration
t = self
format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000)
@dmann
dmann / vpn_fix.sh
Last active August 29, 2015 14:21
#!/usr/bin/env bash
if [ -z $1 ]; then
docker_machine_count=`docker-machine ls -q | wc -l | sed 's/ //g'`
if [ $docker_machine_count == "1" ]; then
machine=`docker-machine ls -q`
elif [ $docker_machine_count == "0" ]; then
echo 'No docker machines were found with the following command:'
echo ' docker-machine ls -q'
exit
else