How Developers Organize Their Code Snippets

If you’ve been developing for some time you probably have a collection of useful snippets that you include in some projects.

For example one of them could be to output the date in the WordPress site footer. If the year is hardcoded during the development of the theme it of course will stay that way. After some time people will notice that you haven’t updated the site in a long time.

One option is to open an older project and copy the code snippet from there and that works great sometime. What if you have used that code multiple times and don’t know which version is the latest?

We have reached out to developers and there were lots of interesting & funny responses.

  • some of them tried to remember the snippets
  • others wrote the code snippets from scratch every time
  • others used a private github/bitbucket/gitlab repository that’s dedicated for code snippets only.
  • GitHub Gistс
  • Real text notepad
  • Ethereum blockchain
  • Google Keep
  • Gisto
  • IDE
  • Foam + vscode.dev
  • Word doc
  • Excel spreadsheet
  • Notepad++
  • Lepton Snippet manager
  • massCode

We at Orbisius also use version control for our snippets as well. In each of the our Orbisius WordPress plugins we have an updater. It allows the plugins to update just like the plugins downloaded from WordPress.org. Over time we’ve added some improvements to make it generic. Having it in git allowed us to always know where to find the latest version.

Also when it’s in git you can track the history and also team members don’t have to reinvent the wheel.

Leave a Comment

Your email address will not be published. Required fields are marked *