Skip to content

Instantly share code, notes, and snippets.

# :PROCESS: ruby, "ruby %f 2>&1"
# :BRACKET_CODE: "[ruby]", "[/ruby]"
# :TEXT:
#
# In the <a
# href="http://devver.net/blog/2009/06/a-dozen-or-so-ways-to-start-sub-processes-in-ruby-part-1/">previous
# article</a> we looked at some basic methods for starting subprocesses in Ruby.
# One thing all those methods had in common was that they didn't permit a lot of
# communication between parent process and child. In this article we'll examine
# a few built-in Ruby methods which give us the ability to have a two-way
class Test::Unit::TestCase
def capture_io
require 'stringio'
orig_stdout, orig_stderr = $stdout, $stderr
captured_stdout, captured_stderr = StringIO.new, StringIO.new
$stdout, $stderr = captured_stdout, captured_stderr
yield
@devver
devver / env.rb
Created September 15, 2009 14:57
Using Construct with Cucumber
require 'construct'
World(Construct::Helpers)
Before do
@construct = create_construct
end
After do
@construct.destroy!
ben@slim:~/code/ruby/gemcutter/gem [master]$ GEMCUTTER_URL=http://staging.rubygems.org gem webhook gemcutter_sample_webhook -a http://ben.devver.net:4567/gemcutter
Adding webhook...
Successfully created webhook for gemcutter_sample_webhook to http://ben.devver.net:4567/gemcutter
ben@slim:~/code/ruby/gemcutter/gem [master]$ GEMCUTTER_URL=http://staging.rubygems.org gem webhook gemcutter_sample_webhook -f http://google.comTest firing webhook...
Successfully deployed webhook for gemcutter_sample_webhook to http://ben.devver.net:4567/gemcutter
gemcutter_sample_webhook:
- http://ben.devver.net:4567/gemcutter1
15 attempted posts
93.3% success rate
- http://ben.devver.net:4567/gemcutter2
8 attempted posts
50.0% success rate
puts "abc".gsub(/a(b)c/) {$1+$1} # bb
puts "abc".gsub(/a(b)c/) { $&+$&} # abcabc
@devver
devver / terms_of_service.markdown
Last active October 22, 2023 03:35
A general Terms of Service under the Creative Commons License

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.