Skip to content

Instantly share code, notes, and snippets.

View fweep's full-sized avatar

Jim Stewart fweep

View GitHub Profile
@fweep
fweep / load_quickfix.vim
Last active December 15, 2015 04:29
Vim function to load .git/quickfix.out into the quickfix window.
function! LoadAndDisplayRSpecQuickfix()
let quickfix_filename = ".git/quickfix.out"
if filereadable(quickfix_filename) && getfsize(quickfix_filename) != 0
silent execute ":cfile " . quickfix_filename
botright cwindow
cc
else
redraw!
echohl WarningMsg | echo "Quickfix file " . quickfix_filename . " is missing or empty." | echohl None
endif
@fweep
fweep / quickfix_spec.rb
Created March 20, 2013 03:34
Simple RSpec spec.
describe "testing quickfix" do
it "should pass" do
true
end
it "should fail" do
fail "this test is broken"
end
end
@fweep
fweep / vim_formatter.rb
Last active December 15, 2015 04:29
Vim quickfix formatter for RSpec 2
# Adapted from https://github.com/bronson/vim-runtest/blob/master/rspec_formatter.rb.
require 'rspec/core/formatters/base_text_formatter'
class VimFormatter < RSpec::Core::Formatters::BaseTextFormatter
def example_failed example
exception = example.execution_result[:exception]
path = $1 if exception.backtrace.find do |frame|
frame =~ %r{\b(spec/.*_spec\.rb:\d+)(?::|\z)}
@fweep
fweep / quickfix_spec.rb
Created March 20, 2013 02:23
Simple RSpec example
describe "testing quickfix" do
it "should pass" do
true
end
it "should fail" do
fail "this test is broken"
end
end
@fweep
fweep / .vimrc
Last active August 23, 2017 11:08
Vim configuration for interacting with cscope databases (focus on Ruby).
if has("cscope")
"TODO: turn this all into a plugin.
set nocscopetag
set cscopequickfix=s-,c-,d-,i-,t-,e-
set nocscopeverbose
if filereadable(".git/cscope.out")
cscope add .git/cscope.out
endif
set cscopeverbose
@fweep
fweep / gist:5148336
Created March 13, 2013 00:16
Clean up duplicate rows in a PostgreSQL table with differing IDs
-- Expensive sub-query method:
delete from questions_tags qt using questions_tags qt2 where qt.question_id = qt2.question_id and qt.tag_id = qt2.tag_id and qt.id != qt2.id and qt.id not in (select min(id) from questions_tags qt3 where qt.question_id = qt3.question_id and qt.tag_id = qt3.tag_id);