Skip to content

Instantly share code, notes, and snippets.

View benwoody's full-sized avatar

Ben Woodall benwoody

View GitHub Profile
### Keybase proof
I hereby claim:
* I am benwoody on github.
* I am benwoodall (https://keybase.io/benwoodall) on keybase.
* I have a public key ASB-iJ_894UEcFlEx14XDff-wEU1ByfkX2swjBLa10ajRAo
To claim this, I am signing this object:
@benwoody
benwoody / gist:7438276
Created November 12, 2013 20:40
field tags with go Structs
...
type MyStruct struct {
MyName string `json:"name"`
}
func (c RenderCorrectJson) Work() revel.Result {
json := MyStruct{MyName: "Ben Woodall"}
return c.RenderJson(json)
}
@benwoody
benwoody / gist:6788761
Created October 2, 2013 03:27
iOctocat bookmarklet
javascript:window.location.href=window.location.href.replace("https://","ioc://");
@benwoody
benwoody / gist:4736048
Created February 8, 2013 02:06
My Git Aliases
[alias]
st = status
co = commit
br = branch
ch = checkout
df = diff
dc = diff --cached
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
@benwoody
benwoody / Default (OSX).sublime-keymap
Created January 2, 2013 03:23
SublimeText2 OSX Keybindings
[
{
"keys": ["super+alt+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.33, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
@benwoody
benwoody / hello_world.coffee
Created October 20, 2012 19:12
coffee script to create a teeny tiny server
server = require('http').createServer (request, response) ->
response.writeHead 200, ('ContentType': 'text/plain')
response.end "Hello World"
server.listen 8124
console.log 'Server running at http://0.0.0.0:8124'
@benwoody
benwoody / .gitterm.bash
Created October 20, 2012 18:08
My Git Color Terminal Thingy
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
@benwoody
benwoody / .autotest
Created October 4, 2012 14:06
.autotest for notify-send
require 'autotest'
module Autotest::Notify
def self.notify title, msg, img, pri='low', time=3000
`notify-send #{title} -i #{img} -u #{pri} -t #{time} '#{msg}'`
end
Autotest.add_hook :ran_command do |autotest|
results = [autotest.results].flatten.join("\n")
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
@benwoody
benwoody / .autotest
Created September 9, 2012 03:15
My OSX Autotest and Rspec files
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |at|
results = [at.results].flatten.join("\n")
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
if output =~ /[1-9]\sfailures?/
growl "Test Results", "#{output}", '~/Dropbox/Photos/autotest/rails_fail.png', 2 #, "-s"
require 'json'
json = JSON.parse(YOURFILE)
a = []
json['entries'].each { |v| a <<v }