Hacker News new | ask | show | jobs
by jrochkind1 1283 days ago
I don't really understand what this post is.

Seems to be just a random collection of random ruby snippets, for clicks? Surprised to see it voted up.

Oh wait... they are snippets from the ruby distribution "sample" folder? I didn't even know there was a ruby distribution "sample" folder.

Looking at the git history, it looks like while a few of the "samples" have been touched in the past few years -- others haven't been touched in 10+ years, and I think maybe all of them originate 10+ years ago... maybe all of them originate from ruby original release? I don't think most people even know about this "sample" folder.

So I guess OP is giving us a tour of it, ok. It's... not that interesting.

https://github.com/ruby/ruby/blob/ruby_3_1/sample/

Some of the samples show you how to use parts of the stdlib, which I guess can be useful. Others, like that second example "biorhythm", are just kind of inexplicable random scripts. (What even is a "biorhythm"?). None of them seem to have any comments (perhaps because they were written by Japanese speakers decades ago?)

These literally decades-old snippets of unclear purpose are probably not actually great examples of how to write current ruby. They may be interesting historically, I wonder how they even got here.