Skip to content

Instantly share code, notes, and snippets.

@olore
olore / some_test.rb
Created June 8, 2011 03:09
overriding TestCase in start towards getting html output report
require "test/unit"
module WatirReporting
def self.included(klass)
klass.class_eval do
alias_method(:add_failure_orig, :add_failure)
alias_method(:add_error_orig, :add_error)
alias_method(:teardown_orig, :teardown)
@olore
olore / ruby-run-focused-unit-test
Last active September 25, 2015 22:58
Ruby vim script for running test unit (with def test_whatever or test "whatever" do or it "whatever" do)
#!/usr/bin/env ruby
filename = ARGV[0]
line_number = ARGV[1].to_i
path = File.expand_path(filename)
export_for_watir = path =~ /watir/ ? "export HEADLESS=1; " : ""
lines = File.read(filename).split(/\n/)
(line_number - 1).downto(0) do |i|
#A tool for displaying memcached key value pairs
#Inspired by: http://code.sixapart.com/svn/memcached/trunk/server/scripts/memcached-tool
#See also: http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
require 'socket'
require 'getoptlong'
@host = "localhost"
@sock = TCPSocket.open(@host, 11211)
@buckets = []