Ask HN: Do you struggle to sleep after coding all day?
Seems whenever I've had a hard day fixing a bug or doing some difficult coding, I struggle to sleep at night thinking about it.
Anybody else suffer from the same? How are you switching off before you go to sleep?
76 comments
[ 2.9 ms ] story [ 152 ms ] threadI've been taking a melatonin supplement lately - it's helped. Cut back on your coffee intake if you drink coffee and try to work out for 10-20 minutes, even if it's just going for a walk or a light bike ride.
With that said, last year I was talking to my doctor about it at my annual physical. He suggested I exercise more often. So for about the last 6-7 months I have made a conscious effort that whenever I feel like I am starting to struggle I will go out for at least a 30 minute walk. I usually end up taking about 4-5 a day. There is definitely a direct correlation between the amount I walk and my productivity. And I am starting to sleep a whole lot better at night. Another thing that has helped me is I stopped drinking soda and now only drink water (or coffee).
Apparently currently I am doing this.
Pick a time for a week and go to bed then regardless of anything else. Try to limit light exposure for the hour before sleeping (no phones in bed) and see if that helps. The more consistent you can be, the more consistent your sleep will be.
Additionally, the Sleep as Android app makes for a great way to track and log sleeping patterns, and has a nice adaptive alarm.
If you have trouble sleeping then it is a very good rule.
Now I just take Melatonin in the evening ( http://www.gwern.net/Melatonin ) and sleep somewhat normally.
EDIT: I also use the flux app, and I reduced my coffee consumption significantly, now down to zero, but melatonin had the quickest and most observable effect.
[0]: https://justgetflux.com/
At least I know the pattern. A problem without solution is already solved: I just pick up a good book and wait it out, knowing I'll be sleepy the next day.
Worked 6am to 2pm at my day job. Came home, ate dinner (late lunch) took a 2 hour nap. Went to Starbucks and worked for 3 hours on my side business and had 2 grande coffees - got home around 9pm and couldn't fell asleep until midnight - one of those sleeps where your not really sure if you actually feel asleep.
Coffee, especially strong coffee, can destroy you late at night.