well this is entertaining topic, talk about rolling on the ground laughing, after reading those ‘hypothetical examples’ - 
but on a serious note, it is like a child learning to read for the first time, they pick up their own methods of learning, though practice, recognizing word and sentence structures, etc., and with us, learning to write code is no different, we all have to start somewhere…
i think if we are honest about it, we all copied somebody’s code in our ‘early days’ and made it work for ourselves, until we became more proficient at it, and could design and write ‘off the top of our heads’ what we needed - it is a form of evolution e.g. from ‘copy-write infringer’ to ‘author’
nobody owns the alphabet (although companies that produce ‘fonts’ may think differently), and so my intellect tells me, i can arrange the letters in any order i like, and it is my work, my copy-write material by default (big deal), we all know of one big software company that claims, it owns the code that some have written, and they even go to the extremes of having patents on ‘the concept of the code’, even though they have no idea as to how they will implement it, let alone figure out how to write it, i think the only thing they are good at is writing bugs in their code, but then again, this could be their trademark 
to hell with the lawyers, and this whole ‘intellectual property’ ownership thing, it is a death spiral of greed, political correctness gone mad, by contrast, look at the open source community, they all work together to benefit the computer users, the operating systems, the software developers never fight over infantile things like ‘thats mine’ (e.g. some-bodies code), no, they share ideas, code, even ‘the shirts off their backs’ if need be… all in the name of advancing technology, unselfishly striving for perfection and the greater good of all
so lets get to the root of the matter… if you ‘used’ some-bodies code, and you have a conscience, and you plan to make money from your endeavor, do the honest thing, and ask for their permission to use it, make an arrangement that suits both parties, including financial reward etc, and you will sleep well at night, knowing you did the right thing
but if they are totally unreasonable or want some exorbitant amount of money for such a small amount of code, use your head and think how you can write your own code to obtain the desired solution/results… hint: renaming variables is a good start, just like the alphabet, nobody has a patent on ‘variable names’
Model: G5 1.8GHz Dual (4 years old now, time for a intel soon)
Browser: Safari 523.12.2
Operating System: Mac OS X (10.5)