rubyists-

seems that there must be about a million cool code snippets stored in this
list - but AFAIK they are not easily searchable.  i'd like to suggest a
subject marker of [EG] for posts containing usefull code snippets (eg. ones
that run and do something usefull).  if something like this exists please
enlighten me.

for now, i am simply limited to search for 'ts or decoux' in the From field.

-a

i was thinking of something *like* this, which would make filtering them pretty
darn easy :

Subject: [EG] topic

then in body of message

----CUT----
# desc
ruby code
----CUT----

as in :

----CUT----
  # a method of representing infinite timestamps
  class Time
    INF   = INFINITY          =  1.0 / 0
    NINF  = NEGATIVE_INFINITY = -1.0 / 0
    EPOCH = Time.at(0)

    class << INFINITY
      include Comparable
      def <=> o;id == o.id ? 0 : 1;end
    end

    class << NEGATIVE_INFINITY
      include Comparable
      def <=> o;self.id == o.id ? 0 : -1;end
    end

    def coerce(x)
      case x
      when Float
	return [x, to_f]
      when Integer
	return [x, to_i]
      else
	super
      end
    end
  end

# test
if __FILE__ == $0
  def display command
    puts "\t#{command}"
    puts "\t\t# >> #{eval command}"
  end

  $now = Time.now
  objects = %w(Time::INF Time::NINF $now)

  objects.map do |a|
    puts '========'
    objects.map do |b|
      puts "\t--------"
      %w(<=> <= >= < > ==).map do |op|
	display "#{a} #{op} #{b}"
      end
    end
  end
end
----CUT----

--
  ====================================
  | Ara Howard
  | NOAA Forecast Systems Laboratory
  | Information and Technology Services
  | Data Systems Group
  | R/FST 325 Broadway
  | Boulder, CO 80305-3328
  | Email: ahoward / fsl.noaa.gov
  | Phone:  303-497-7238
  | Fax:    303-497-7259
  ====================================