This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
server=$1 | |
port=$2 | |
lport=${3:=$port} | |
# stdout will be server | |
# stderr will be client | |
exec 3>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
## | |
# Public: This is my foo route | |
# | |
# See #/bar for examples (but it doesn't link) | |
# But this[#baz] does | |
get '/foo' do | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install image_science -v 1.2.3 | |
gem install image_science -v 1.2.4 | |
export INLINEDIR=/tmp/.ruby_inline | |
ruby -e "gem 'image_science', '1.2.3'; require './test_inline.rb'" | |
ruby -e "gem 'image_science', '1.2.4'; require './test_inline.rb'" | |
rm -rf /tmp/.ruby_inline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def test_whatever | |
flunk 'sucks' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This method gets doc'd | |
# | |
# :method: foo | |
add_my_method :cool, :method | |
## | |
# This method does not get doc'd | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class ThreadPool | |
## | |
# Should the worker threads abort on exception? default: false | |
attr_reader :abort_on_exception | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# https://gist.github.com/3115168 | |
def shell_execute *args | |
io = IO.for_fd(3) | |
io.sync = true | |
io.puts *args | |
rescue Errno::EBADF | |
abort 'FD 3 is not open.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sequel | |
module Plugins | |
# The ForceTypecast plugin exists because as far as I can tell, ruby-oci8 | |
# nor sequel has a way of overriding the column type returned from the | |
# database. | |
# | |
# This plugin is copied from TypecastOnLoad and offers similar | |
# functionality. The differences being that instead of taking an array of | |
# columns it takes a hash. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'version_sorter/version' | |
ARGV.options.version = VersionSorter::Version | |
# long options also have default short options | |
opts = ARGV.getopts('', 'reverse') rescue abort( ARGV.options.to_s ) | |
require 'version_sorter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download: | |
# $ curl -O https://gist.github.com/bhenderson/1447788/raw/git-rpie | |
# $ chmod u+x git-rpie | |
# $ git rpie -h | |
help() { | |
cat <<-EOU | |
Usage: |