Skip to content

Instantly share code, notes, and snippets.

@joakimk
joakimk / rspec_retries.rb
Last active Jun 10, 2016 — forked from seancribbs/rspec_retries.rb
A simple way to retry examples in RSpec using filters and around
View rspec_retries.rb
# Based on https://gist.github.com/1718985
# Usage:
# 1) Put in spec/support/rspec_retries.rb
# 2) Call from spec_helper.rb: "RSpec::Retries.setup(config)"
# 3) Change around filter to suit your needs.
# Example output:
# ..............
#
@joakimk
joakimk / example_output.txt
Created Jan 11, 2012 — forked from henrik/example_output.txt
Ruby on Rails initializer to log Savon SOAP XML as pretty JSON instead. Also show what line of code called it.
View example_output.txt
--------------------------------------------------
lib/foo.rb:22:in `save'
# foo.book
>> REQUEST:
{
"CashBook_Book": {
"cashBookHandle": {
"Number": "14"
@joakimk
joakimk / gist:1185872
Created Sep 1, 2011 — forked from metaskills/gist:1124322
Patch Ruby 1.9.3.preview1 GC Tuning Noise
View gist:1185872
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -416,7 +416,6 @@
malloc_limit_ptr = getenv("RUBY_GC_MALLOC_LIMIT");
if (malloc_limit_ptr != NULL) {
int malloc_limit_i = atoi(malloc_limit_ptr);
- printf("malloc_limit=%d (%d)\n", malloc_limit_i, initial_malloc_limit);
if (malloc_limit_i > 0) {
initial_malloc_limit = malloc_limit_i;
@joakimk
joakimk / pivotalstatus.rb
Created Jun 23, 2011 — forked from aalin/pivotalstatus.rb
Pivotal tracker git status thing...
View pivotalstatus.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'pivotal-tracker'
class String
ANSI_COLORS = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white]
def colorize(color)
num = ANSI_COLORS.index(color) or raise("Bad color #{ color }")
"\e[3#{ num }m" + self + "\e[0m"
@joakimk
joakimk / bot.rb
Created Apr 29, 2011 — forked from jpr5/bot.rb
XMPP/Ruby Bot for HipChat with support for multiple rooms
View bot.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'xmpp4r'
require 'xmpp4r/muc/helper/simplemucclient'
# Most of this is borrowed from https://gist.github.com/941931
# Added support for multiple rooms and external handling of messages.
# We want the MUC functionality to just handle shit for us. Unfortunately we
# have to override/repeat the join method in order to add the directive that
View failures_during_run_formatter.rb
# http://gist.github.com/gists/593755 (fork of http://gist.github.com/485785)
require 'spec/runner/formatter/progress_bar_formatter'
class FailuresDuringRunFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def example_failed(example, counter, failure)
super # show the 'F' in progress
dump_failure(counter, failure)
end
end
class Spec::Runner::Reporter
You can’t perform that action at this time.