Skip to content

Instantly share code, notes, and snippets.

@tddium
tddium / gtalk.rb
Created October 24, 2012 18:23
Google Talk Post-Build Notifier
#!/usr/local/bin/ruby
# Copyright (c) 2012 Solano Labs All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
@tddium
tddium / tddium.rake
Created June 27, 2012 21:21 — forked from tehpeh/tddium.rake
Installing hstore extension in Postgresql 9.1 database for Tddium
# Copyright (c) 2011, 2012 Solano Labs All Rights Reserved
namespace :tddium do
desc "load database extensions"
task :db_hook do
Rake::Task["db:create"].invoke
Kernel.system("psql #{ENV['TDDIUM_DB_NAME']} -c 'CREATE EXTENSION hstore;'")
Rake::Task["tddium:default_db_hook"].invoke
@tddium
tddium / gist:2869891
Created June 4, 2012 18:00
Ruby 1.9.3-p0 vs 1.9.3-p194 Encoding Madness
# encoding: UTF-8
opts = {:invalid => :replace, :undef => :replace, :replace => '', :newline => :universal}
s, b = 'ード', 'بلآ'
puts s.encoding.name
s.to_s.encode('UTF-8', opts
@tddium
tddium / campfire.rb
Last active October 2, 2015 13:58
Campfire Post-Build Notifier
#!/usr/local/bin/ruby
# Copyright (c) 2012 Solano Labs All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
@tddium
tddium / s3store.rb
Created March 28, 2012 21:01
Secure S3 Storage for Tddium
#! /usr/bin/env ruby
# Copyright (c) 2012 Solano Labs All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
@tddium
tddium / tddium.rake
Created March 15, 2012 07:14
Installing Postgres database extensions in Tddium
# Copyright (c) 2011, 2012 Solano Labs All Rights Reserved
namespace :tddium do
desc "load database extensions"
task :db_hook do
Rake::Task["tddium:default_db_hook"].invoke
# There is not yet a way to determine Tddium PG version from environment
contrib = '/usr/share/postgresql/8.4/contrib/hstore.sql'
Kernel.system("psql #{ENV['TDDIUM_DB_NAME']} -f #{contrib}")
@tddium
tddium / tddium.rake
Created December 25, 2011 21:59
Example tddium db hook
# Copyright (c) 2011 Solano Labs All Rights Reserved
# lib/tasks/tddium.rake
namespace :tddium do
desc "default tddium environment db setup task"
task :db_hook do
Rake::Task["db:create"].invoke
if File.exists?(File.join(Rails.root, "db", "schema.rb"))
Rake::Task['db:schema:load'].invoke
else
Rake::Task['db:migrate'].invoke
class CucumberExternalResqueWorker
DEFAULT_STARTUP_TIMEOUT = 1.minute
COUNTER_KEY = "cucumber:counter"
class << self
attr_accessor :pid, :startup_timeout
def start
# Call from a Cucumber support file so it is run on startup
return unless Rails.env.cucumber?
@tddium
tddium / capybara_debug.rb
Created November 16, 2011 19:54
Trap Capybara Stack Trace
### Show stack trace for 500 errors
### (adapted from https://gist.github.com/1079020)
# Given an application, yield to a block to handle exceptions
class ExceptionRaiserApp
def initialize(app)
@app = app
end
def call(env)