You should be using a clipboard manager
If you don’t have one already, install one and start using it.
- Set a LONG history (mine is 3 months).
- Now every code snippet you ever copy is in an easily searchable database so you can pull it back up whenever you need it.
I personally use Paste and it’s the best I’ve found. Whatever you use, make sure it has the ability to search quickly and keep months of data.