This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "testing quickfix" do | |
it "should pass" do | |
true | |
end | |
it "should fail" do | |
fail "this test is broken" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "testing quickfix" do | |
it "should pass" do | |
true | |
end | |
it "should fail" do | |
fail "this test is broken" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ uname -a | |
Darwin lemur.wired.fweep.com 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 i386 MacBookAir4,2 Darwin | |
$ vim --version | |
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 19 2013 10:54:27) | |
Included patches: 1-244, 246-762 | |
Compiled by jim@lemur.wired.lan.fweep.com | |
Huge version with GTK2 GUI. Features included (+) or not (-): | |
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent | |
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StudentsController < ApplicationController | |
before_filter :find_student, only: [:show, :update] | |
def show | |
# @student will already be loaded here | |
# do whatever | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from myapp.tests.helper import create_user | |
SQLALCHEMY_URL = "postgresql://unireg@localhost/myapp" | |
def _init_testing_db(): | |
from sqlalchemy import create_engine | |
from myapp.models import DBSession, Base | |
engine = create_engine(SQLALCHEMY_URL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.authentication import AuthTktAuthenticationPolicy | |
from pyramid.authorization import ACLAuthorizationPolicy | |
from myapp.tests.base import ViewTestBase | |
from myapp.views.authentication.login import login_view | |
from myapp.tests.helper import create_user | |
class LoginViewTests(ViewTestBase): | |
def setUp(self): |
OlderNewer