Some code related parts of the programming are usually the same and we tend to use that same code across several experiments/applications, so rather than remembering the whole information about a specific code and re-writing the same code across several experiments/applications, it’s always easier to remember what that pipeline/algorithm is instead.
There are several code snippets managers, however, since I personally give more importance to privacy and decentralisation (It's me, I just don't want to store my code on someone else’s cloud/server). I would recommend DECS, as the must-have chrome extension.
With DECS - Code Snippets Manager (https://chrome.google.com/webstore/detail/decs-code-snippets-manage/mkclebnkdjjpamialfgieminnkdepbcl?hl=en), You could store the code snippets fully encrypted anywhere you would want to, and use the same code across several applications just by copy-pasting. This will help you in storing an infinite amount of important information without actually forgetting, even including the API keys, and is always just a search away, saving a lot of time and money.
To add cream on top, with DECS browser extension, using just a single click, you can capture the snippets that catch your eye (anywhere on a webpage including Stack Overflow) and store them forever for future use.
This medium blog https://medium.com/@decs/decs-th... will explain the uses in more detail way.