You write code on your personal computer outside of work hours, it belongs to you (barring truly terrible and likely unenforceable contracts). Let's say you put it up on github.
The next day you download it onto your work laptop and use it to solve problem X. I don't think there's any reasonable interpretation where your company now owns it.
The next day you download it onto your work laptop and use it to solve problem X. I don't think there's any reasonable interpretation where your company now owns it.