Skip to content

Instantly share code, notes, and snippets.

View kgodard's full-sized avatar

Kim Godard kgodard

  • KGB Enterprises
  • Erie, CO
View GitHub Profile
@kgodard
kgodard / rails_controller_formatted_responses.rb
Created April 9, 2013 17:26
rails controller formatted error responses for multiple error types
module Api
class ApiApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate_api_user!
rescue_from Exception, :with => :render_500
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
rescue_from ActionController::RoutingError, :with => :render_404
rescue_from ActionController::UnknownController, :with => :render_404
rescue_from ActionController::UnknownAction, :with => :render_404
@kgodard
kgodard / gist:5072573
Last active December 25, 2023 04:54
how to print avery labels with only a .csv and a web browser

NOTE: DO AVERY LABEL IMPORT STUFF IN FIREFOX -- I DON'T THINK THE AVERY SITE IS COMPATIBLE WITH CHROME

Steps described in this document:

  • Edit and sort your labels file in Google Docs (not in Excel)
  • Download your data as a .csv file
  • Import your edited .csv file into the Avery label maker site (not using Excel)
  • Print labels

  1. Edit and Sort label data in Google Docs
@kgodard
kgodard / gist:3700416
Created September 11, 2012 18:09
fix author on last several commits
In the case where just the top few commits have bad authors, you can do this all inside git rebase -i using the exec command and the --amend commit, as follows:
git rebase -i HEAD^^^^^^ # as required
which presents you with the editable list of commits:
pick abcd Someone else's commit
pick defg my bad commit 1
pick 1234 my bad commit 2
Then add exec ... --author="..." lines after all lines with bad authors:
@kgodard
kgodard / .bashrc
Created August 14, 2012 15:11
My .bashrc (work)
# http://www.reddit.com/r/ruby/comments/wgtqj/how_i_spend_my_time_building_rails_apps/c5daer4
# More suitable settings for ruby when running rails apps
export RUBY_HEAP_MIN_SLOTS=800000
export RUBY_HEAP_FREE_MIN=100000
export RUBY_HEAP_SLOTS_INCREMENT=300000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=79000000
#my stuff
#alias git commands to use hub
@kgodard
kgodard / .vimrc
Created July 13, 2012 20:09
My .vimrc (work)
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'
" ---------------