A couple thoughts - saving and reusing code is absolutely a great practice - and I tend to think it's totally up to the developer how you archive your previous work and other useful code samples.
But... a few caveats from the view of a big company:
- I'm assuming it's a given that among your tweaks are renaming classes, methods and variables as necessary if they impact the problem domain of the current work.
- Be aware of where and how you store code that was written on your company's nickel. I know that many companies would be very upset to discover that code that they consider proprietary has been stored on the internet IN ANY FORM. The issue isn't mitigated by saying that it's in an account controlled only by you (GoogleDocs, Evernote, etc). The issue is that the code is in a place the company's security officer and lawyers did not approve. Storing it on your hard drive - no big deal. Storing in on a company supported file share - no big deal.
- Be aware and check in with management on whether you can take code (even a small bit of it) from another job and unless you know it's OK, don't move code between jobs. The code is generally work for hire and it's owned by the company. The inter-company legal stuff is quite a mess and management is likely not to want any piece of a lawsuit involving getting sued by another company for intellectual property theft.
This is more of a problem in bigger companies with the potential to be targets for massive lawsuits. I can't say much about smaller companies - I don't work in one.
It's a fine line between inspiration and referencing a previously successful solution and cribbing code from a 3rd party. I tend to think that most Internet example code is safe since it's usually demonstrating a mechanism. It's when you are pulling down sizeable chunks of code that you have no intention of rethinking or rewriting that you are most at risk (and that doesn't sound like the case here).
I'm mostly pointing out the tricky area, and the areas that are most likely to involve long and frustrating conversations with lawyers and business people who have no clue about what the work is actually like. Since these people will be looking for black and white, it's good to avoid the triggers for such conversations whenever possible.