One liner quiz!

Hi!

My quiz suggestion is to generate such a string in Ruby:

±-==72wanfuiy==–+
| yourwebsite.com |
±-==yiufnaw27==–+

Some kind of ascii art, with a frame where we can see a random string
in the upper border and its reverse counterpart in the bottom border.

But: the solution must be a one-liner! No temporary variables, etc.

(One can use such a string to set in mp3 or video files comment
metadata, to change its CRC, or promoting their website.)

puts “±-==#%s==–+\n| %s |\n±-==%s==–+” %
[(ARGV[0].crypt(ARGV[0])*10)[0…ARGV[0].size],ARGV[0],(ARGV[0].crypt(ARGV[0])*10)[0…ARGV[0].size].reverse]

Not bad, but the random text part isn’t random in fact, it is a function
of the website url ARGV[0]. It should be random, and must be changing at
every invocation of the command, so one can change the CRC of a mp3 or
video file by simply adding this small piece of ASCII art as comment
metadata to the file.

Such kind of temporary variables like .map{|z| …} are allowed.

Thx, my solution was:

puts
(“±-==#{Array.new(23+ARGV[0].size-25){[(‘a’…‘z’),(‘0’…‘9’)].sample}.join}==–+\n"2).split("\n").collect.with_index.map{|z,i|
eval(“z.”+(“reverse.”
(i+1)).split(”.").join("."))}.join("\n|
#{ARGV[0]} |\n")

[Array.new(ARGV[0].size){‘0123456789abcdefghijklmnopqrstuvwxyz’.chars.sample}.join].each{|x|puts
“±-==%s==–+\n| %s |\n±-==%s==–+”%[x,ARGV[0],x.reverse]}

sample output:

±-==d0rligpk2o==–+
| google.com |
±-==o2kpgilr0d==–+

or

±-==6og6ioid7p==–+
| google.com |
±-==p7dioi6go6==–+

You might be interested in http://codegolf.stackexchange.com