Recently there's been a load of discussion and debate about Code Is Art, and how deviantART is inappropriately handling Copyright issues with Code submissions to the site.
Well, really, I'm not going to add fuel to a fire, but generally, I think there's a fairly solid rule to go by: Someone isn't ripping your code unless more then 85% of the code is the original code.
As far as protecting your code legally, try adding a license header to your code, is JavaDoc format like so:
* author (https://www.deviantart.com/author) YOUR NAME
* copyright (https://www.deviantart.com/copyright) LINK TO COPYRIGHT DOCUMENT
Others who are having their say about it are:
Something Else: This j