In my opinion the only thing that should be an infringement regarding code is copying entire non trivial files or entire projects outright.
A 100 line snippet should not be copyrighteable. Only the entire work, which you could think as the composition of many of those snippets.