Skip to content

Instantly share code, notes, and snippets.

View sdhull's full-sized avatar
🏃
Gettin it

Steve Hull sdhull

🏃
Gettin it
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sdhull on github.
  • I am stevehull (https://keybase.io/stevehull) on keybase.
  • I have a public key whose fingerprint is 822E 48FF C43D 9BAF B0AF 0040 9A92 6BFE 6F18 D843

To claim this, I am signing this object:

@sdhull
sdhull / find_unused_css_js.rb
Last active August 29, 2015 14:13
Static analysis to hunt down unused css & js after removing view code. Comment out the haml2html stuff if you are starting with erb/html
# script assumes you have already `git rm app/views/foo/bar.haml`, the more removed code the better
require 'httparty'
# find_deleted_lines
deleted_haml = `git diff --cached --diff-filter=D app/views`
# remove info about which file
cleaned_lines = []
in_head = 0
@sdhull
sdhull / rails_routing_invalid_chars_fix.rb
Last active August 29, 2015 13:56 — forked from bensomers/rails_routing_invalid_chars_fix.rb
fix for invalid encodings that are extended ascii / windows 1252
# Fix for a Rails - Ruby 1.9 bug
# Rails Router, now that it's UTF-8 default, blows up when routing requests
# with invalid chars in the URL; it should properly return a 400 error
# Have to monkey-patch the fix in, since it's not scheduled for release until
# Rails 4.0.
# Adapted Andrew White (pixeltrix)'s fix at
# https://github.com/rails/rails/commit/3fc561a1f71edf1c2bae695cafa03909d24a5ca3,
# but edited to work in 3.0.x.
# 3.1.x, 3.2.x compatibility unknown
require 'action_dispatch/routing/route_set'
@sdhull
sdhull / .vimrc.before
Created July 12, 2013 00:36
This is a key mapping in vim so that leader-f will copy current file name to your keyboard in OSX
nnoremap <silent> <Leader>f :<C-u>silent !echo % <bar> pbcopy<CR>
@sdhull
sdhull / benchmark ruby memcache gems
Created February 14, 2013 23:47
Up-to-date Benchmark of memcache-client vs memcached vs dalli vs a couple others. libm = memcached mclient = memecache-client
! ruby /Users/sdhull/.rvm/gems/ruby-1.9.2-p180@memcachebm/gems/memcached-1.5.0/test/profile/benchmark.rb
Darwin parallax 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.3]
RUBY_VERSION=ruby-1.9.2-p180
Ruby 1.9.2p180
Loaded memcached 1.5.0
Loaded remix-stash 1.1.3
Loaded memcache-client 1.8.5
Loaded kgio 2.8.0
Loaded dalli 2.6.2
let mapleader = ","
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
map <Leader>p "0p
map <Leader>nh :nohlsearch<CR>
map <D-T> :tabedit<CR>
@sdhull
sdhull / .vimrc.after
Created June 6, 2012 21:32
vimrc after file
colorscheme vividchalk
"macmenu &File.Open\ Tab\.\.\. key=<nop>
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>', '<MiddleMouse>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
set nowrap
@sdhull
sdhull / run_tags.rb
Created June 6, 2012 21:30
place in .git/hooks to get ctags workin
#!/usr/bin/env ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
require 'rubygems'
require 'ruby-debug'
CTAGS = `which ctags`.chomp
@sdhull
sdhull / pre-commit
Created April 17, 2012 23:36
.git/hooks/pre-commit
#!/usr/bin/env ruby
file_names = `git diff-index --cached -Sdebugger --name-only HEAD`
file_names += `git diff-index --cached -Ssave_and_open_page --name-only HEAD`
file_names = file_names.strip
if file_names != ""
puts "The following files have 'debugger' or 'save_and_open_page' statements in them: "
puts file_names
raise "Please complete your merge prior to committing" unless ENV["FORCE"]
end
@sdhull
sdhull / gist:1032348
Created June 17, 2011 21:04
odd behavior with bins and bash path
<parallax:stevehull> 0 [06-16 16:12] (master)~/Dev/stevenday
! which rake
./bin/rake
<parallax:stevehull> 0 [06-16 16:10] (master)~/Dev/stevenday
! rake -T
rake aborted!
You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.
(See full trace by running task with --trace)