Any Ruby devs here? Need a line of T-Shirt code translated

I don't think the girl is as good as she thinks she is. - Or, it was some smartass boy who was having a joke? Either way, those hex values do not spell that sentence exactly.

Thanks
Pauly
Or it was intentionally written wrong by a clever girl because she knew silly boys would waste a lot of time trying to figure why it was wrong and what it was supposed to do.

Touché clever girl! :D
 
I don't think so... The range only specifies the start and end characters from the string but there's "junk" in the middle of the string, too.
I'm saying a range operation to extract the good characters (and probably a subsequent substitution for the missing characters) was intended to follow the encoding to fix up the string. However I believe that range/substitution step is mostly missing. In fact, the syntax error is evidence that something is missing. That seems a lot more likely than typos in the input. The encoding looks very intentional. It would be difficult to produce that output by making a couple of typos :).
 
I'm saying a range operation to extract the good characters (and probably a subsequent substitution for the missing characters) was intended to follow the encoding to fix up the string. However I believe that range/substitution step is mostly missing. In fact, the syntax error is evidence that something is missing. That seems a lot more likely than typos in the input. The encoding looks very intentional. It would be difficult to produce that output by making a couple of typos :).
Yeah... That would make sense.
 
I believe this is the correct formulation. In other words, the shirt is missing the characters between ".." and ".gsub(/" They probably needed to shorten it to fit on the shirt and figured nobody would notice :).

Never_Underestimate_a_Girl_Who_Can_Code == ["\\\×D7\xAFz\xBDT\x9D\×D7\xABz\xCBb\x99\xAB^\×D5\xADF\x8A\xB9uZ\x1A5\t\×A9\xF5\n\x87^"].pack('m0')[1..-1].gsub("MOXRD",'N').gsub("cOXRD",'d').gsub("w", '').gsub("dEN",'').gsub("cOXQT",'a').gsub(/\d/,'_')
 
Last edited:
I believe this is the correct formulation. In other words, the shirt is missing the characters between ".." and ".gsub(/" They probably needed to shorten it to fit on the shirt and figured nobody would notice :).

Never_Underestimate_a_Girl_Who_Can_Code == ["\\\×D7\xAFz\xBDT\x9D\×D7\xABz\xCBb\x99\xAB^\×D5\xADF\x8A\xB9uZ\x1A5\t\×A9\xF5\n\x87^"].pack('m0')[1..-1].gsub("MOXRD",'N').gsub("cOXRD",'d').gsub("w", '').gsub("dEN",'').gsub("cOXQT",'a').gsub(/\d/,'_')
Yeah, that would do it! But kinda kills whatever code elegance they were probably going for. :)
 
Or it was intentionally written wrong by a clever girl because she knew silly boys would waste a lot of time trying to figure why it was wrong and what it was supposed to do.

Touché clever girl! :D
I think this is the answer. A girl makes a single statement and the boy spends hours trying to figure out what she's really talking about. :)
 
The original code as pasted in the first post has some misleading "x" characters in it when pasted into an interactive Ruby console. This surprised me.


"\\\×D7\xAFz\xBDT\x9D\×D7\xABz\xCBb\x99\xAB^\×D5\xADF\x8A\xB9uZ\x1A5\t\×A9\xF5\n\x87^"

See the subtle difference between the first × and the second x ? The characters are similar but not the same and certainly don't have the same meaning. I hate it when that happens! Oh the time that I've lost to that sort of thing.

So it looks like this code was simply transcribed incorrectly from the tshirt, and that the original intention of the code was correct.

If I fix up the x characters in the hex encoding, then the result is as expected:

Screenshot 2022-12-20 at 2.48.56 PM.png

Also note: [1..] is legal in recent versions of Ruby, but will give you syntax errors in older versions; which is what you saw with some online Ruby interpreters.
 
Last edited:
Wait... the last post was from weeks ago? I only replied because I thought that this was a current thread 🤦‍♂️.
 
@jellodog - Wow, well after weeks you came out with the answer. I wonder how that would have gotten in there - must have been re-written by one of the online compilers perhaps as I don't know how to type that character that looks 99.5% like an x but isn't. :)
 
The original code as pasted in the first post has some misleading "x" characters in it when pasted into an interactive Ruby console. This surprised me.


"\\\×D7\xAFz\xBDT\x9D\×D7\xABz\xCBb\x99\xAB^\×D5\xADF\x8A\xB9uZ\x1A5\t\×A9\xF5\n\x87^"

See the subtle difference between the first × and the second x ? The characters are similar but not the same and certainly don't have the same meaning. I hate it when that happens! Oh the time that I've lost to that sort of thing.

So it looks like this code was simply transcribed incorrectly from the tshirt, and that the original intention of the code was correct.

If I fix up the x characters in the hex encoding, then the result is as expected:

View attachment 112974
Holy hell - great eyes!

The mystery is solved and my inner detective is satisfied :)
 
Back
Top Bottom