Is possible to prevent a site using my code?
<p>I was told even when we cannot patent the code, there is a copyright or intellectual property on it. But what can we do with that? is that protecting from someone else using the code?</p>
<p>If yes, what are the legal tools to act on some site using that code?</p>
<p>Because I can also think in different scenarios:</p>
<ol>
<li><p>Javascript code, without modification: if some site is copying the code is easy to check, code is visible</p>
</li>
<li><p>Javascript code, modified (minified, obfuscated, or some minor changes to the code)</p>
</li>
<li><p>Backend code, without modification: in this case we don't have access to it, how can we know if they are using our code then?</p>
</li>
</ol>

<p>What you can do with copyright protection is sue a person who infringes on that right. As a pre-lawyer step, you could file a DMCA notice with the service provider alleging infringement, which should get the stuff taken down, but the process is a bit formalistic and still boils down to filing an infringement lawsuit.</p>
<p>Then you have to provide evidence that it is most likely that your code was copied. It naturally depends on the nature of the code, but degree of similarity can be quantified, and a paid expert could testify that is is extremely unlikely that the similarity is by accident or is natural (e.g. the centigrade-to-farenheit conversion formula). This also holds for modifications. If you have a good reason to claim that they have infringed code in an invisible location, you can get a subpoena requiring them to provide you with a copy so that you can do your forensic analysis on that code.</p>

<p>Usually it is difficult and expensive to prove that your code is used somewhere else as pointed out in the answer from user6726. Sometimes it becomes obvious like <a href="https://www.theverge.com/tldr/2016/5/4/11593084/dont-get-busted-copying-code-from-stack-overflow" rel="nofollow noreferrer">here</a>. It is especially difficult if your code is slightly modified or someone runs an obfuscator over it.</p>
<p>A simple trick you can do is the following: Modify some constants (e.g. pi or sqrt(2)) slightly which has no impact on your calculations but will probably not be changed by someone copying your code:</p>
<pre><code>final double PI = 3.14159264359; 
</code></pre>
<p>Looks like pi but is wrong by 0.0000003 % and will most likely not be modified, and it usually still there after obfuscation.</p>
<p>At least you could now approach the copyright violator with a good proof.</p>

copyright intellectual-property software