Tommorrow is the deadline, boy did it come fast!!? It's twisted but some of us have procrastinated just a tad as the thrill of an all-nighter makes things sharp and real- it must be the adrenaline.

But how do you keep your mind on the game as the hours slip away and your eyes burn and squint? Do you eat lots of candy? Gulp cup after bitter cup of coffee? Down Red Bull and groove to speed metal? Sprint round the block hoping to trounce the build? What's your secret to an overnight coding challenge? Somebody help!!!!!

49 accepted

Start by closing the web browser and getting to work!



and set stackoverflow.com to in your hosts file.


Eat healthy - a good dark green leafy salad. Vitamin B. No more coffee than usual. Take a short break such as a walk around the building every 2-3 hours. Chair yoga.

For a crunch time, it's pretty much the same answers as for other questions that asked about keeping one's mind sharp, staying in shape, but just being stricter, more serious about it.


The code you write after being awake 18 hours isn't worth using. Your brain will go into lockup and you can't keep all the details straight. The resulting frustrating bugs will make it worse.

Before getting to that point, give up and get at least 6 hours sleep.

"I love deadlines. I love the sound they make as they whoosh past." -- Somebody


Firstly, it's not a great idea to do this!

From my university days; combine Red Bull with Pro Plus. Red Bull reduces the tiredness and Pro Plus the overwhelming need to sleep (believe me the two are separate). It is an act of will after that!


Coffee, snacks, music, make sure you take breaks occasionally if only for a few minutes at a time.


If this happens too frequently, point browser to Job site


Hopefully, late night are the exception for you, not a regular occurance!


Loud music with incomprehensible words so you aren't tempted to sing along.


If you wake up easily, taking a bit of caffeine before a short nap feels a lot like a longer amount of sleep. If you are already sleep deprived, you'll probably sleep through your nap timers, and it is better to just stay awake.

I've had good results with small amounts of caffeine over time, rather than one large intake.

Eye drops seem to help. The longer I stay awake, the worse my head and eyes feel, so putting something cold over the eyes for 10 minutes helps. I use one of these.

Lastly, your sense of time tends to get screwed up the longer you go. Try setting a timer which goes off every 15 to 30 minutes to make the passage of time more visible.


Music, caffeine, and occasional exercise. I've found a few sets of pushups really help when I get sleepy.


Chewing gum has kept me awake at the end of nearly 48 hours. It works because the brain is wired to stay awake if there is anything in your mouth that might choke you.


A pause from time to time keeps staying productive.


Junk food of any kind, and Pandora.

Needless to say, all-nighters and good health are mutually exclusive.


Frequent showers helped me a lot. Have 2 or 3 a night, they help reduce the sticky feeling that comes with exhaustion.

Tea works great, and is reasonably healthy. If tea fails, Red Bull and aspirine are the next level up.

Snacking doesn't help much, I'd focus on having a few decent meals instead.

ps. If your hair is long, consider getting it cut. (seriously)


Pre-red bull days it was cup of sludge made by steeping a tea bag in a cup of coffee. I'd stick with a sensible plan of regular breaks for naps/exercise/real food. It's not worth killing yourself over. The more tired and stressed you are, the more mistakes you will make... which leads to more time fixing them making you more tired and stressed leading to more mistakes ad nauseum.


Burn the Midnight Oil...to CD.

Ok that was weak. Sorry.


According to the book Brain Rules a nap of 30 - 45 minutes will increase your productivity for 5 or 6 hours. Of course, the author is suggesting you do this as a normal part of your afternoon and get 6 to 8 hours sleep at night! However, maybe it would help.


During Night-outs the adrenaline level automatically increases and I start working seriously. During those days (ooops nights), my manager also keeps an watchful eye on everyone.

Probably this is a dumb answer.


Buy that gaget you have wanted, you know the one the wife has banned your from wasting money on. Then only allow yourself to use it once you have completed the job.


I have found that, along with the music & caffine, a ball of some sort - soccer ball/football/baseball, or a Frisbee (be careful) to pass back and forth while discussing next steps or taking a breather keeps the energy up.


Travel to a far-away place and make jet lag work for you.


Give up. You've made a mistake, and there is no way out of it. If you try, you end up with code that is sub-par and will tar your reputation. Best bet is to contact whoever it is that is waiting for the code, and ask for an extension. Don't ask for one day, ask for more - you want to write code, and test it, and improve it, and test it, before the deadline - but don't ask for any more days since you will probably repeat your mistake.

With this project out of the way, examine what got you to the point of having to do an all-nighter. You need to prevent that. Is it that you're not interested in the project? Is it that you have too much going on in your life? Is it that you think you can finish it all in one day and you then realize you were wrong? Do you need to work within better structure? More procedures? Do you need supervision from another person, or can you do with the kind of supervision that a web based project management app can provide.

Just don't kid yourself that finishing a project by pulling an all-nighter, is cool. Code that is rushed is not cool.


Take 15min naps every 3-4 hour, like being in übermann sleep mode... it may take some practice to actually just fall asleep and then wake up again in 15-25min but rebooting the brain by doing it really helps me to think clearly again.

Napping too long though will not work, as at least I will feel less rested and possibly even more sleepy than before if it's not truly a quick nap. Not being able to truly fall asleep briefly during the nap will also prevent any effect, obviously.

A 3 hour sleep may be easier to do and will, for most people I guess, include a deep sleep cycle and relieve the mind of more stress. It might feel a bit tiresome getting up but that should quickly pass, especially with some added activity like PE and/or breakfast ^^

But I'd lean towards the "don't do it" side in practice. Only if it's a hobby project of mine I really care for - I'd pull all-nighters just for the fun of it. I do experience deadline problems with some of my technical writing side-jobs but I usually just spend a few hours on it, go to sleep and then get up really early and be done around lunch that day instead of trying to have it ready in the morning.