I store most of my personal code on GitHub, accessible to anyone. I have a lot of reasons to do it and couldn’t find any reason not to do it.
I have nothing to hide
Most of my personal code is my sites’ code or tools that I use to develop my sites. Anyone can unminify this code and read if they really want.
I can use GitHub and Travis CI and any other open source tool for free
I like GitHub and I don’t like Bitbucket (they have free private repositories). I like to store all my code in the same place — it’s convenient. I also like Travis CI and use it for all my projects, even for my blog.
I can publish to npm for free
Sharing code with npm is much more convenient than copypasting. And you don’t have to pay for private npm.
It forces me to write better code
My future coworker may find it and may judge my coding skills by this code. I don’t want him to look into a wrong project so I try to make all my public code good. Later me will thank current me for that.
It forces me to write documentation
Nobody likes to find a project that seems useful but has no documentation or even comments in the code. Me too, even if it’s my own code.
I can send a link to show my code
Often someone asks how I do this or that. If this or that is open sourced I could just send a link to a file on GitHub. I can even select particular lines in that file.
I receive pull requests with grammar fixes
It’s rare but it’s real. Some people love to fix bugs or typos if they can. I’m one of them.
Someone else may find it useful
That’s very cool though very rare for me. Maybe one day.