One of the first things I learned when going to a creative writing class was: Get a sketchpad; Have it with you where ever you go; Use it. Artists are known to do this. Some of these sketch pads are even considered art.
Yet I see lots of software developer who don't seem to have a sketch pad. If you are one of those, you should change that NOW. This doesn't mean you have buy one of these old fashioned paper things. For our profession there are other (possibly better) alternatives:
Your phone: It probably has some way of keeping notes. Heck you can even record audio if you like. This is perfect for making sure you have it available at at all times.
Groupware: Outlook for example has 'notes' where you can type (or copy) bits of text. As usual you can create folders and search for notes.
Google Docs: You can have multiple documents, different types of documents, you can share them ... oh ... and of course you can search them
Dropbox syncs a folder on your various PCs (or Macs or whatever) automatically in the background. You can create and edit documents any time on any machine and as soon as an internet connection becomes available it gets synchronized with the storage on the web. And every other machine gets the new version as soon as they are on the net. Works like a charm and is free for amounts of data that should suffice for almost all sketchpad. I like dropbox because it doesn't limit you in the formats you use. For example I sometimes feel like collecting some ideas as a mind map. In such a case I put that mind map in my dropbox.
A wiki: If you have your own webspace you might be able to setup a wiki, which is at least for me the best option, since you can easily arrange your content and link between and to it.
I personally use a media wiki instance as my main sketchpad and use all the other stuff for special purposes.
As so often the technical solution is the simple part. The important part is getting into the habit of using it. So what should you put into your sketchpad? Of course it is really up to you to decide but you should put there everything you might be interested in later. This probably includes
Code Snippets: Cool solutions of a problem, examples of API usage, scripts.
Links to interesting articles, forum questions of which the answers are interesting or important
Ideas of things you want to do or to try or explore.
What ever you put in your sketchpad, make sure you put some note to it, what it is good for. Otherwise you might end up with tons of snippets of which you have no idea what they do. Not very helpful. It also eases searching in your sketchpad.
In any case it is better to put to much in it then not enough, so in case of doubt put it in. This also helps in the beginning to get in the habit of using your sketchpad.
Of course there is a second kind of usage to it. Its not doing much good if you only put stuff in. You should also refer to your sketchpad for the stuff you put in there. For this it helps when you organize your sketchpad in a way that makes you see other parts of it when putting new content in. So don't make your notes / chapters / articles to short, but keep multiple stuff on one page. You also might go through your sketchpad occasionally to clean it up, to add some notes and to review whats in there.
So if you don't have a sketchpad start one now. If you have one, let us know where it is and what kind of stuff is in there.