I told my boss I had an idea for a program that could improve efficiency across much of the business, and he let me build it on company time. In the long term, he wanted to be able to sell it to other companies. However, the program never got implemented due to personnel mismanagement, and I’d rather be able to post it on my github under a free licence so I can use it as a resume item, and at least someone would have the chance to actually use it. It’s all still in my head, and I could write it again if I wanted. If I do, is it illegal to publish it? What if I write it in a different language? Do I need to change the variable names? I did plenty of research and planning on company time to build it, and it’s not like I can research it again, it’s all still in my head.
Write it down for now so you do not lose the memory if it is so precious to you. Maybe it will be even better the next time coding it. I think many coders have a “loose copy” or a “code gist” of previous versions of their favorites codes around. I never created a code that I framed and hanged on my wall, but some came close. I would not publish it under your real name any time soon. At least not as long as you work in that company +1-2y. If you choose to publish it in the next 6 month under a very different name, in another account, with another repo name, because you love FOSS so much, and it looks different to the original code in format and style (and the presentation of data = frontend), then I see no problem. Just two guys having a similar idea. Not a lawyer though.