Skip to content

Instantly share code, notes, and snippets.

View joshk's full-sized avatar
🥸

Josh Kalderimis joshk

🥸
  • Valued
  • Wellington, NZ
  • 00:18 (UTC +02:00)
View GitHub Profile
module Round
end
module Rectangular
end
class Thing
extend Round
class << self
def metaclass
@kilaulena
kilaulena / js_steps.rb
Created July 7, 2011 22:10
test capybara visibility
Then /^"([^\"]+)" should be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
Then /^"([^\"]+)" should not be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
@indirect
indirect / better_logger.rb
Created July 19, 2011 07:00
Rails 3 logs with severity and PIDs
# You must require this file in application.rb, above the Application
# definition, for this to work. For example:
#
# # Syslog-like Rails logs
# if Rails.env.production?
# require File.expand_path('../../lib/better_logger', __FILE__)
# end
#
# module MyApp
# class Application < Rails::Application
@franckverrot
franckverrot / gist:1105103
Created July 25, 2011 20:27
Travis-CI CFP

"Travis CI - Distributed, Continous Integration for the Ruby community

""The future is already here — it's just not very evenly distributed."" (William Gibson)

The Ruby community is where a lot of this future already happens. We not only set the bar higher and higher every day, we've also built most of the infrastructure use day to day. Twitter, Github, Gemcutter, Pusher to just name a few projects that changed the world, the way we live and work.

With Travis CI, an open source continous integration service for the Ruby community, we are

@wardbekker
wardbekker / .travis.yml
Created July 30, 2011 07:33
Travis.yml erlang proposal
# https://github.com/travis-ci/travis-ci/wiki/.travis.yml-options
target: erlang
use_rebar: true
erlang_otp:
- R14B03
- R14B02
- R14B01
- R14B
- R14A
- R13B04
@jamis
jamis / demo.rb
Created August 3, 2011 21:56
Repairing a unicode string that contains invalid characters
# encoding: utf-8
s = "Blah \xe9 blah 헌글"
puts "BEFORE"
puts "encoding: #{s.encoding}"
puts "valid : #{s.valid_encoding?}"
puts "text : #{s}"
s = s.
Vagrant::Config.run do |config|
# config.vm.box = "natty32_base"
config.vm.box = "lucid32"
# config.vm.box_url = "http://dl.dropbox.com/u/7490647/talifun-ubuntu-11.04-server-i386.box"
config.vm.box_url = "http://files.vagrantup.com/lucid32_old.box"
config.vm.forward_port 'ssh', 22, 2220
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks/vagrant_base"
@nicksieger
nicksieger / akuma.rb
Created October 11, 2011 17:33
Daemonizing JRuby with Akuma
require 'rubygems'
require 'java'
require 'mvn:org.kohsuke:akuma'
d = com.sun.akuma.Daemon.new
if d.daemonized?
puts "Daemonizing with PID #{$$}"
d.init
else
d.daemonize
@mislav
mislav / readme.md
Created January 25, 2012 14:42
CLI tool that checks the build status of current branch on Travis CI

Check build status of a project on the command line

Install (copy & paste):

curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
  && chmod +x ~/bin/travis

gem install hub | tail -2
ruby -e 'require "json"' 2&gt;/dev/null || gem install json

This is a distillation of a technique we use internally at Basho to reduce the pain of cloning some of our larger repos. It relies a bit on shell scripts and environment variables, but it can be run more directly, as I show below.

  1. Create a bare git repository in some directory, e.g. /var/lib/gitcache.

    git init --bare /var/lib/gitcache
  2. Add all repositories you want to cache as remotes to the git repository, e.g.