Skip to content

Instantly share code, notes, and snippets.

View johnbintz's full-sized avatar

John Bintz johnbintz

View GitHub Profile
@johnbintz
johnbintz / pretty_step_writer.rb
Created April 18, 2012 15:27
Write out undefined Cucumber step definitions, one per file
# this writes out undefined step definitions, one per file, in the usual way that i do cucumber stuff.
# it saves a *lot* of copypaste from the terminal. still in progress as i refine the process.
# use it as a formatter: cucumber -f StepWriter --out features/step_definitions
# save it to support/env/step_writer.rb
require 'cucumber/formatter/io'
class StepWriter
include Cucumber::Formatter::Io
@johnbintz
johnbintz / jsmeter.js
Created February 20, 2012 19:36
Run JSMeter on your code, getting a reasonable output to start cleaning up code complexities
#!/usr/bin/env node
// npm install -g jsmeter
(function () {
var verbose = false;
var args = process.argv;
var fs = require("fs");
@johnbintz
johnbintz / gist:1809410
Created February 12, 2012 16:15
For the lazy, how to Guard::Guard your own Guard
# Guardfile
require 'guard/guard'
class ::Guard::JohnIsAwesome < ::Guard::Guard
def start
puts "Whoa a guard."
end
def run_all
@johnbintz
johnbintz / ingdirect.user.js
Created February 1, 2012 11:27
Get rid of that stupid-ass Rapport ad that doesn't obey "Maybe Later" like it should.
// ==UserScript==
// This fixes the most annoying thing I've ever seen on the ING DIRECT website. Sorry, ING DIRECT folks.
// @match https://secure.ingdirect.com/*
// ==/UserScript==
var waiter;
waiter = function() {
if (mask = document.getElementById('adWizardPopup_mask')) {
mask.parentNode.removeChild(mask);
@johnbintz
johnbintz / gist:1649884
Created January 20, 2012 22:08
Get all the logging and exceptions from your Capybara-driven Rails app in your Cucumber environment
# come here mr. ducky, i just want to punch you
module Capybara
class << self
def logger_target
@logger_target ||= StringIO.new
end
attr_writer :backtrace_clean_patterns
def backtrace_clean_patterns
@johnbintz
johnbintz / gist:1312690
Created October 25, 2011 13:17
CoverMe with HtmlAndConsole formatter for RSpec, and no browser window opening
if ENV['COVERAGE']
require 'cover_me'
class CoverMe::HtmlAndConsoleFormatter < CoverMe::HtmlFormatter
def format_index(index)
super
puts "\n\n[CoverMe] Current coverage: #{index.percent_tested}%"
end
end
CoverMe.config do |c|
@johnbintz
johnbintz / build.sh
Created August 4, 2011 13:57
Build latest MacVim, activating and deactivating all the right things along the way
#!/bin/bash
if [ ! -z $(which ruby | grep '.rvm') ]; then
echo "Switch to system ruby!"
exit 1
fi
echo "Building latest MacVim..."
sudo port activate libiconv
@johnbintz
johnbintz / Rakefile
Created August 4, 2011 13:38
Make Hydra Rake task safer and more useful
begin
require 'hydra'
require 'hydra/tasks'
if ENV['RAILS_ENV'] == 'test'
Hydra::TestTask.new('hydra:spec') do |t|
t.add_files 'spec/**/*_spec.rb'
end
else
puts "No Hydra task unless you're running with RAILS_ENV=test"
@johnbintz
johnbintz / Guardfile.rb
Created August 3, 2011 22:33
Guard::Hydra to use Hydra for run_all
require 'guard'
require 'guard/guard'
require 'guard/rspec'
module ::Guard
class ::Guard::Hydra < ::Guard::RSpec
def start
UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!"
super
end
@johnbintz
johnbintz / gist:1092247
Created July 19, 2011 13:09
Install new Ruby using RVM and with require patch
file="/tmp/ruby-1.9.2p290.patch"
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > $file
rvm install 1.9.2 --patch $file
rvm 1.9.2
gem install bundler