I'm currently working on a certain problem for my company (i.e. where I work for hire and don't own the code I produce in any way). It appears, that in one of my past (or, who knows, maybe still present) personal projects there are a few useful source code files that should help with the problem I'm working on. Neither that personal project nor the company project are open source, and they are not going to become so in foreseeable future.I would like to import that (small) part of my personal project into the company's source tree. But since I'm not yet calling my project RIP, I'd like to give them the code in the way that I retain my copyright over the code. And, of course, they would need to have the copyright over the code as well - luring them into a trap is definitely not my intention. In that regard I would like to give them any right I can - to modify, run, distribute, use in other projects etc., but not to deprive me of the same rights. And I don't care if that (again, small) part of my project becomes publicly available eventually.The solution I currently have for this is:Put the copyright information along with the license into every source code file I'm about to import.Commit this to my Git repository (hosted privately).Import the specific files and commit them their repository (hosted as GitHub private repository).The licensing text I'm using is based on MIT license, but slightly modified (I added the third paragraph), here it is:# Copyright (c) 2013 Real Developer Name## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the Software), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:# # The above copyright notice and this permission notice shall be included in# all copies or substantial portions of the Software.## The above exclusively applies to files containing this copyright notice, and# does not apply for the rest of the software package containing these files.## THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN# THE SOFTWARE.So, the questions are:Most importantly, will this measure protect both parties from the possible legal issues?Is the fragment I added (the third paragraph) necessary and/or useful? Can it be improved?Is it a generally good idea to give your own code to your company to speed up development (assuming that my and their projects will never ever compete)?
Licensing code from my personal project to my company via an open-source license
licensing;mit license
As a copyright holder, you have the right to distribute copies of (part of) your personal project to different people using different licenses. So, there is no need to open source part of your personal project just to be able to include it in the work you currently make for your employer.The alternative option is to tell your boss that you have some code from a personal project that would fit well here and then sit together with your company's lawyer/legal department to draft a non-exclusive license for them to use the code.If you don't make any silly demands, this should be a straightforward process and you won't have to deal with any fears that might exist regarding the use of open source software.Regarding your concrete questions:This copyright license is as good as it gets to protect both of you from copyright infringement claims. It doesn't protect either of you from other legal issues such as patent claims.The fragment you added is stating the obvious and is not necessary. By default, a copyright license only applies to those files that claim to be governed by that license.Whether it is a good idea to share your code with your company is a matter of opinion. It can be argued either way and the final decision should be based on what you feel comfortable with yourself.