Been there, done that. In grad school, I would sleep on foam rubber pallet in the corner of the computer lab so I wouldn't have to make the drive home and then back again. This could on for 2-3 days, a week, until a goal was reached. "loopy" is a good description. The next day it's all in the past. I remember visiting this code several years later, "what the hell was I thinking". We didn't have a work remotely option in those days. Only slow baud rate modem stuff.
"A little time, a little trouble, your better day" Badfinger