Why would you publish code that was written during working hours?
Why not publish an university project, a learning exercise, or something you built for fun? Surely there is more reason to create something than you're getting paid to do it, right? Or are artists just silly?
I think some of my university projects are published. But they're quite old by now, and not representative of the production code I write. I do learning exercises quite frequently when getting into new libraries/frameworks/languages, but again, that's on company time.
I don't begrudge others that do, but I don't code in my free time, I have other hobbies. Thus getting back to the original point made:
> Because every skilled person has time to build stuff in public.