Skip to content

Instantly share code, notes, and snippets.

View colszowka's full-sized avatar

Christoph Olszowka colszowka

View GitHub Profile
@bitbckt
bitbckt / resque.rb
Created January 20, 2010 21:32
munin plugin for resque
#!/usr/bin/env ruby
require 'rubygems'
require 'resque'
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1'
PORT = ENV['port'] ? ENV['port'] : '6379'
Resque.redis = "#{HOST}:#{PORT}"
@xaviershay
xaviershay / acceptance_runner.rb
Created June 4, 2011 05:04
Parallel tests with unified SimpleCov coverage
require 'parallel'
class AcceptanceRunner < MiniTest::Unit
def initialize(opts = {})
super()
@opts = opts
end
def _run_suites_in_parallel(suites, type)
@fguillen
fguillen / crontab
Created August 9, 2011 09:05
Cron & RVM & Bundle & Rails & Rake & log
00 01 * * * /bin/bash --login -c 'cd <your app> && RAILS_ENV=production /usr/bin/env bundle exec rake <your rake>' >> /var/log/<your app>.log 2>&1
SimpleCov.at_exit do
percent = SimpleCov.result.covered_percent
unless percent == 100.0
puts "Coverage is not at 100% !!!!"
Kernel.exit(1)
end
end
@krisleech
krisleech / README.md
Created February 23, 2012 15:50
A Micro Gem for commenting out lines of Ruby/Erb
hide do          
          _     _     _            
    /\  /(_) __| | __| | ___ _ __  
   / /_/ / |/ _` |/ _` |/ _ \ '_ \ 
  / __  /| | (_| | (_| |  __/ | | |
  \/ /_/ |_|\__,_|\__,_|\___|_| |_|
end
@mbleigh
mbleigh / Gemfile
Created March 21, 2012 03:14
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@dstrctrng
dstrctrng / gist:5315149
Last active December 15, 2015 19:59
Running a docker with runsvdir, ssh in, then destroy it
function d {
did=$(docker run -d precise runsvdir /etc/service)
ip=$(docker inspect $did | grep IpAddress | cut -d'"' -f4)
nc -z $ip 22 && ssh -oStrictHostKeyChecking=no root@$ip
docker kill $did
}
@bradleypriest
bradleypriest / konami.js
Last active December 17, 2015 00:29
Ember.KonamiCode
Ember.KonamiCode = Ember.Mixin.create({
konami: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13],
currentIndex: 0,
keyPress: function(event) {
this._super(event);
var index = this.get('currentIndex');
if (event.keyCode === this.konami[index]) {
if (index === 10) {
this.success();
} else {
@mbleigh
mbleigh / matchers.rb
Created September 7, 2012 16:53
RSpec matcher for JSON responses.
RSpec::Matchers.define :have_json_key do |expected_key|
match do |response|
@body = MultiJson.load(response.body)
result = @body.key?(expected_key.to_s)
result &&= @body[expected_key.to_s] == @expected_val if @val_provided
result
end
chain :with_value do |val|
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end