I’m poking fun of the fact that you took a lot of time to paste your copyright over a 15 line code snippet, even coloring it red in an image for extra importance.
The red is a result of using Greenshot to add the text - it’s the default color and styling.
As for the copyright, CC BY 4.0 just asks that you attribute for the code and don’t claim it as your own. A quick google search would’ve yielded that.
Would you be the guy who adds his copyright to a single line var a = b;?
No, and assuming that about someone is quite irrational.
We’re trying to help people here, you’re right. That’s why I posted a better solution with no strings attached.
So then don’t prefix your solution with a snarky comment, rather, “Here’s my solution that takes into account x, y, and z and this is why it’s better.” It’s not hard to have a civil discussion.