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
@sdhull
sdhull / Notes from expert vim talk at RailsConf 2010
Created June 14, 2010 21:06
Notes from expert vim talk at RailsConf 2010
Keep a "Tool-sharpening list"
Keep a list of things that annoy you or feel inefficient, figure out how to make them better
Help
:h
:h buffers (with tab-complete)
:h buffers (then control-d for a list of matching stuff)
It's hyper-linked, ctrl-] to follow link, ctrl-o to back out
  • Whether you have locked or not: not locked
  • What version of bundler you are using: 0.9.26
  • What version of Ruby you are using: ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]
  • Whether you are using RVM, and if so what version: no, this is system ruby Your Gemfile source :gemcutter gem 'rails', '2.3.2' gem 'authlogic', '2.1.1' gem 'geokit', '1.4.1' gem 'rmagick', '2.9.0', :require => false
@sdhull
sdhull / cap_bundler_weirdness.output
Created October 28, 2010 23:51
bizarre output with bundler + capistrano
* executing `deploy:bundle_install'
* executing "cd /ip/releases/20101028213017 && /opt/local/ruby/bin/bundle install --deployment"
servers: ["app2"]
[app2] executing command
** [out :: app2] Fetching source index for http://rubygems.org/
** [out :: app2] Fetching source index for http://gems.rubyonrails.org/
** [out :: app2] Could not fetch prerelease specs from rubygems repository http://rubygems.org/, http://gems.rubyonrails.org/
** [out :: app2] Installing rake (0.8.7)
** [out :: app2]
** [out :: app2] Installing activesupport (2.3.2)
@sdhull
sdhull / gist:668461
Created November 8, 2010 23:23
the problem
class ViewContext
def initialize(*args)
@_content_for = Hash.new
end
def content_for(name, content, &block)
content = capture(&block) if block_given?
@_content_for[name] = content
end
end
@sdhull
sdhull / resque.rake
Created April 9, 2011 17:05
ensure your application actually loads for resque workers in rails 3
require 'resque/tasks'
task "resque:setup" => :environment do
Rails.application.eager_load! unless Rails.env.development?
end
@sdhull
sdhull / clockwork.rake
Created April 23, 2011 06:10
rake task (including contents of old clock.rb file) to start/stop/restart clockwork.rb
namespace :clockwork do
desc 'Start the clockwork daemon'
task :start => :environment do
pid = fork do
$stdout.reopen("/dev/null")
$stdout.sync = true
$stderr.reopen($stdout)
include Clockwork
handler do |job_class|
@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)
@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 / 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 / .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