One place I worked had a small park, so sometimes I'd go for a lap or two to think something through - the fresh air, mild exercise, change of scenery and lack of distractions wroked wonders.
Nothing more enchanting than when the answer to your coding problem literally comes to you in a dream. Had an array issue in C++ where I literally woke up saying "I don't need a ghost array to search after all is said and done, it's already sorted!"