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 :
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----
···
Subject: [EG] topic
–
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
====================================
Could it be [EX] for “Example”? I can’t imagine what [EG] could mean.
I’m sure that it comes from ‘e.g.’ in English, but I don’t know where
‘e.g.’ comes from either.
I like the idea, but I see a practical difficulty with it. Most code
snipets apprear as replies to previous posts. I guess that we could
alter the title when we respond though.
···
On Sat, Mar 22, 2003 at 05:25:16AM +0900, ahoward wrote:
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.
Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137
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----
We can moreover define a namespace, probably following the RAA:
----[CUT: foo.rb]----
puts “FOO”
----[END: foo.rb]----
And we have single-handily created the new RAA for code snippets 
···
On Sat, Mar 22, 2003 at 05:25:16AM +0900, ahoward wrote:
Subject: [EG:/Application/Development] bla
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
The state of some commercial Un*x is more unsecure than any Linux box
without a root password…
– Bernd Eckenfels
Daniel Carrera wrote:
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.
Could it be [EX] for “Example”? I can’t imagine what [EG] could mean.
I’m sure that it comes from ‘e.g.’ in English, but I don’t know where
‘e.g.’ comes from either.
It’s Latin for ‘exempli gratia’, which means “for example”. ‘EX’ makes
sense, but only if English is your native language. Of course, I have
no idea if “e.g.” is regularly used (or used at all) in other languages.
Regards,
Dan
···
On Sat, Mar 22, 2003 at 05:25:16AM +0900, ahoward wrote:
–
a = [74, 117, 115, 116, 32, 65, 110, 111, 116, 104, 101, 114, 32, 82]
a.push(117,98, 121, 32, 72, 97, 99, 107, 101, 114)
puts a.pack(“C*”)
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.
Could it be [EX] for “Example”? I can’t imagine what [EG] could mean.
I’m sure that it comes from ‘e.g.’ in English, but I don’t know where
‘e.g.’ comes from either.
exempli gratia
I like the idea, but I see a practical difficulty with it. Most code
snipets apprear as replies to previous posts. I guess that we could
alter the title when we respond though.
We can attach the categorization to the body instead of to the header…
···
On Sat, Mar 22, 2003 at 05:30:12AM +0900, Daniel Carrera wrote:
On Sat, Mar 22, 2003 at 05:25:16AM +0900, ahoward wrote:
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
People are going to scream bloody murder about that.
– Seen on linux-kernel
THIS is along the lines of what i was thinking. i think this approach could
yield a large body of really cool ruby code in short order. if whatever
interface was created alowed the snippets to be cross references and rated it
could be a very usefull database. let’s here it for
http://snippet.ruby-lang.org
in fact,
[SNIPPET]
is as good a subject as any IMHO - though i still like the
un-english-centric [EG]
-a
ps. that reminds me, it think RAA projects should be rated too - a simply
this package rocks
this package is weak
check box type voting would be pretty neat to see. the voting could be
summarized as
RAA PACKAGE FOO
42 favourable
6 unfavourable
···
On Sat, 22 Mar 2003, Mauricio [iso-8859-1] Fernández wrote:
We can moreover define a namespace, probably following the RAA:
Subject: [EG:/Application/Development] bla
----[CUT: foo.rb]----
puts “FOO”
----[END: foo.rb]----
And we have single-handily created the new RAA for code snippets 
–
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
====================================
Could it be [EX] for “Example”? I can’t imagine what [EG] could mean.
I’m sure that it comes from ‘e.g.’ in English, but I don’t know where
‘e.g.’ comes from either.
It’s Latin for ‘exempli gratia’, which means “for example”.
Thanks. I had been wondering about that.
‘EX’ makes sense, but only if English is your native language. Of
course, I have no idea if “e.g.” is regularly used (or used at all) in
other languages.
Well, since ruby-talk is an English mailing list, I think this is
reasonable. Just the same way that [Q] makes sense for ‘question’ and
‘ann’ makes sense for ‘announcement’ only if you speak English.
BTW, in Spanish people don’t use ‘e.g.’. People use ‘ej.’ for ‘ejemplo’.
I would expect that other romance languages are similar.
···
On Sat, Mar 22, 2003 at 05:38:19AM +0900, Daniel Berger wrote:
–
Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137
We can moreover define a namespace, probably following the RAA:
Subject: [EG:/Application/Development] bla
----[CUT: foo.rb]----
puts “FOO”
----[END: foo.rb]----
And we have single-handily created the new RAA for code snippets 
THIS is along the lines of what i was thinking. i think this approach could
yield a large body of really cool ruby code in short order. if whatever
interface was created alowed the snippets to be cross references and rated it
could be a very usefull database. let’s here it for
The major advantage I see is that it lowers the barrier to archive the
snippets. In my own (limited) experience, I’ve posted some code to
ruby-talk but only 3 things were actually put in the Wiki, and I’m not
really sure it is the proper place to store them in (although it is more
justified if explanations are involved).
If we assume snippets have no dependencies (each one should run
independently), a command-line interface should be fairly easy to make.
ruby-snippet search “find IP address”
name1 description bla bla bla
name2 description bla bla bla
…
nameN description bla bla bla
ruby-snippet show nameI
It doesn’t really make sense to have ‘install’ as snippets are intended
to be short, ready to cut&paste.
http://snippet.ruby-lang.org
in fact,
[SNIPPET]
is as good a subject as any IMHO - though i still like the
un-english-centric [EG]
-a
ps. that reminds me, it think RAA projects should be rated too - a simply
this package rocks
this package is weak
check box type voting would be pretty neat to see. the voting could be
summarized as
RAA PACKAGE FOO
42 favourable
6 unfavourable
Would something like “trust metric” [1] be applicable to this?
[1] http://www.advogato.org/trust-metric.html
···
On Sat, Mar 22, 2003 at 06:25:45AM +0900, ahoward wrote:
On Sat, 22 Mar 2003, Mauricio [iso-8859-1] Fernández wrote:
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
Sigh. I like to think it’s just the Linux people who want to be on
the “leading edge” so bad they walk right off the precipice.
– Craig E. Groeschel
There can hardly be a lower barrier to archiving snippets than the
Wiki. Many or most snippets in the Wiki are marked
“CategorySampleCode”, so you can easily browse the list of them (as
well as a regular Wiki search).
I think the community is better served if the person authoring the
snippet puts it in the Wiki first, and then just posts a URL. Or
perhaps posting the snippet then archiving it right away.
Gavin
···
On Saturday, March 22, 2003, 8:43:22 AM, Mauricio wrote:
And we have single-handily created the new RAA for code snippets 
THIS is along the lines of what i was thinking. i think this approach could
yield a large body of really cool ruby code in short order. if whatever
interface was created alowed the snippets to be cross references and rated it
could be a very usefull database. let’s here it for
The major advantage I see is that it lowers the barrier to archive the
snippets. In my own (limited) experience, I’ve posted some code to
ruby-talk but only 3 things were actually put in the Wiki, and I’m not
really sure it is the proper place to store them in (although it is more
justified if explanations are involved).
The major advantage I see is that it lowers the barrier to archive the
snippets. In my own (limited) experience, I’ve posted some code to
ruby-talk but only 3 things were actually put in the Wiki, and I’m not
really sure it is the proper place to store them in (although it is more
justified if explanations are involved).
There can hardly be a lower barrier to archiving snippets than the
Wiki. Many or most snippets in the Wiki are marked
“CategorySampleCode”, so you can easily browse the list of them (as
well as a regular Wiki search).
The barrier is lower if you can send snippets by email, IMHO.
The Wiki calls for further explanations, and really small snippets don’t
seem to belong in there.
A tool specifically designed for small code samples would be both easier
to use and more powerful than the Wiki (always IMO).
I think the community is better served if the person authoring the
snippet puts it in the Wiki first, and then just posts a URL. Or
perhaps posting the snippet then archiving it right away.
“Why spend 5 minutes doing it by hand if I can spend 5 days automatizing
it?” 
I still think it’d be cool to have some tool extracting snippets from
ruby-talk. Just imagine the huge codebase we could get simply by parsing
Guy’s (Decoux) posts [1]
Then somebody could categorize them later.
[1] I think everybody will agree on that 
···
On Mon, Mar 24, 2003 at 11:37:55AM +0900, Gavin Sinclair wrote:
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
Netscape is not a newsreader, and probably never shall be.
– Tom Christiansen