Created
August 12, 2016 19:02
-
-
Save jrunning/15c4867c9cbe77e3dd0f516725992354 to your computer and use it in GitHub Desktop.
https://repl.it/Cm9I/0 created by jrunning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn= | |
->s{w=s=~/\n/ | |
i=0 | |
s.scan(/(..|.\n)(?=.{#{w-1}}(..|.\n))?/m).map{|a|(("%4s"%(a*"")).tr($/," ").bytes.reduce(:+)/4.0).round.chr*2}.each_slice(w/2+w%2){|l|puts l*="",l if i%2<1 | |
i+=1}} | |
fn[<<END] | |
%%%%%%%%%%%%% | |
% Hello, % | |
% world! % | |
%%%%%%%%%%%%% | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] | |
>>> $$>>II99###### | |
$$>>II99###### | |
$$##88KKGG#### | |
$$##88KKGG#### | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment