I don't have much to contribute, but I have come up with code in my sleep, in fact, dreamed code which would solve a particular problem. You wake up with the code and have no idea if it's actually good or not, you just know in your dream it worked. In this case it worked.