Skip to content

Instantly share code, notes, and snippets.

@tmiller
tmiller / pivotal_tracker_cli.go
Last active December 16, 2015 13:19
Pivotal tracker CLI example
package main
import (
"fmt"
"github.com/tmiller/pt"
"os/exec"
)
func main() {
pivotalTracker := pt.PivotalTracker{"API Key"}
# lib/cryptography_adapter.rb
# Parent adapter class
class CryptographyAdapter
def encrypted?(data)
raise "Method not implmented"
end
def decrypt(data)
@tmiller
tmiller / trailing_spaces.json
Created April 3, 2013 22:51
Trailing spaces settings
{
"trailing_spaces_highlight_color": "invalid",
"trailing_spaces_modified_lines_only": true,
"trailing_spaces_include_current_line": false,
"trailing_spaces_trim_on_save": true
}
@tmiller
tmiller / merge
Last active November 14, 2021 11:16
Bash script to merge master into all branches
#!/bin/bash
# Merges the master branch into all other branches
#
# Process:
#
# - Save the name of the current branch
# - If the current branch is not master then checkout master.
# - Pull the latest changes for master from its upstream branch.
# - Loop over each local branch.
@tmiller
tmiller / README.md
Last active December 15, 2015 06:28
Using the gem ptb to prepare commit messages.

Usage

Place this file in my_project/.git/hooks/prepare-commit-msg to have git automatically use ptb to prepare your commit messages for you.

You also need to give execute permisions to prepare-commit-msg

chmod +x myproject/.git/hooks/prepare-commit-msg
def fibonacci(nth, series = method(:fibonacci))
if nth < 2
nth
else
series[nth - 2] + series[nth - 1]
end
end
# The easiest memoization in the world:
fibs = Hash.new { |series, nth| series[nth] = fibonacci(nth, series) }
/*
Package pivotaltracker implements a wrapper around Pivotal Tracker's API.
*/
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
@tmiller
tmiller / .gitconfig
Last active December 14, 2015 06:29
[user]
name = Tom Miller
email = [email protected]
[color]
# turn on colors for all projects
ui = true
# I need to look this up again
[color "status"]
added = green
<%
def database_adapter
if Bundler.load.specs.map(&:name).include? "mysql2"
"mysql2"
else
"mysql"
end
end
def database_name(environment)
@tmiller
tmiller / gist:3787980
Created September 26, 2012 13:18
Get status of working tree
git status --porcelain | sort -u | sed -e 's/^.\(.\).*/\1/' -e 's/M/*/' -e 's/D/-/' -e 's/?/+/' | tr -d '\n'