Here is a tip for those ideas that come to you in the middle of the night, and keep you awake. Take something off you bedside table and throw it on the floor, telling yourself at the same time that when you see it you will remember that thought. And hey presto! When you get up and see it, you are reminded of what you thought of – plus you went straight to sleep once you threw that object on the floor.
It always works for me.