few times when the days were very long and I kept banging my head without a solution, getting a bit of rest helped - was surprised how easy I got the solutions the next day ( I think fatigue was a factor there).
Another thing I have learnt to do and found to be very helpful - surround myself with a lot of good and relevant books.
Around 70% of my programming solutions, I get from the net, the other 30% from books. Quite often (at least for me), the books also help me to figure out what to ask on the net.
These, just in addition to the other very good suggestions in the comments.