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 / .vimrc
Last active January 25, 2018 16:02
vim setup
execute pathogen#infect()
syntax on
filetype plugin indent on
" Tabs/spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
@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 / README.md
Last active January 9, 2019 15:56
A bookmarklet that compiles steps and minutes active into a single table, which can be to copy/pasted directly into Duke's Get Moving Challenge submission page.

Installation

Copy the raw text from the get_moving_bookmarklet.min.js file. Open the Bookmark Manager in your web browser. Add a new bookmark and paste the minified javascript into the url field.

Usage

Go to the Fitbit website and log in. Once logged in, click your newly created bookmark and a table should show up at the top of the page. While the bookmarklet will work from any page on Fitbit's site, I've found that it looks best when launched from the Food Log page.

@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
// ==UserScript==
// @name FB Auto Logout
// @description Automatically log out of Facebook when the tab is closed.
// @author D.Mann
// @include http://www.facebook.com/*
// @include https://www.facebook.com/*
// @version 1.0
// ==/UserScript==
//document.getElementById('pageLoginAnchor').getElementsByTagName('a')[0].click();
@dmann
dmann / com.apple.TimeMachine_OnMount.plist
Last active August 29, 2015 14:18
Overriding Time Machine's default behavior to do a single backup when a backup drive is connected and eject the drive when the backup is complete.
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.apple.TimeMachine_OnMount</string>
<key>StartOnMount</key>
<true/>
<key>Program</key>
<string>/usr/local/bin/timemachine_backup.sh</string>
</dict>