On Aug 3, 2006, at 12:01 AM, ara.t.howard / noaa.gov wrote:

> On Thu, 3 Aug 2006, Matt Todd wrote:
>
>> Yes, but that means those people would need to become unified, but I
>> somehow think that, at the genesis of these competing sites, they've
>> become, themselves, competitors, and possibly unable to unify in that
>> regard.
>>
>> So, you are faced with an awkward decision: use none or make your own
>> that will become the defacto.
>>
>> Hmmm, and neither of those really work, do they? (Despite your  
>> clout.)
>>
>> But, you're right, I'd like them to be unified as well.
>>
>> M.T.
>
> long ago i suggested the subject line [SNIPPET] for postings to  
> comp.lang.ruby
> - google already indexes it - it would at least be a single unified  
> space.
>
> -a

This is an idea I like. So in honor of the fact that I stole the  
format for this script from you ara, I'd like to present my favorite  
little script / snippet, rbmlexample:

Usage: ruby rblmlexample.rb <somefile.rb> [ arguments for somefile.rb ]
It copies the results of running somefile.rb and also somefile.rb to  
the clipboard on Mac OS X (In ara's style of cat blah.rb ruby  
blah.rb), where you can then paste it into a ruby talk email.

It's dependent on pbcopy, but I imagine a little search and replace  
could  adapt it for xclip. In retrospect this is probably a bit too  
long to be a snippet. Ah well.



% cat rbmlexample.rb
#!/usr/bin/env ruby
$VERBOSE = true
begin
   file_name = ARGV.shift or raise 'You need to supply a file name'
   IO.popen('pbcopy', 'r+') do |clipboard|
     clipboard.puts "% cat #{file_name}"

     file_src = nil
     File.open(file_name) do |source_code|
       file_src = source_code.read
     end
     clipboard.puts file_src

     clipboard.puts ''

     ruby_res = nil
     IO.popen('ruby 2>&1', 'r+') do |ruby|
       ruby.puts 'STDOUT.sync = true'
       ruby.puts %Q{
       begin
         old_verbose = $VERBOSE
         $VERBOSE = nil
         ARGV = #{ARGV.inspect}
       ensure
         $VERBOSE = old_verbose
       end
       }
       ruby.puts file_src
       ruby.close_write
       ruby_res = ruby.read
     end
     clipboard.puts "% ruby #{file_name}"
     clipboard.puts ruby_res
   end
rescue => ex
   STDERR.puts "#{File.basename($0)}: error: #{ex.message}"
end





> -- 
> we can never obtain peace in the outer world until we make peace with
> ourselves.
> - h.h. the 14th dali lama
>