• Home
  • -
  • How to pull an epic, all-night coding session

How to pull an epic, all-night coding session

We’ve all been there.

Deadline looming the next day and still a mountain of coding to get through. Even if you’re not a developer, we all have to stay up all night at some point to study for an exam, finish a project or simply get through every single Star Wars film.

create an anonymous Techloop profile

But it’s not easy, our bodies just aren’t used to going without sleep for so long and many of the things that are supposed to help can actually end up making us more tired and less productive.

With that in mind, we’ve come up with 8 ways to smash that all-nighter and get the job done.

all nighter developer

1) Learn how to nap
Clearly, the best way to defeat sleep deprivation is to actually get some sleep, which is why starting your all-nighter with a short nap can be really beneficial. In fact, it’s best to do it at the beginning when you’re not so tired, rather than later on when your body is craving a deep sleep.

Keep your nap short, around 20 minutes, to avoid falling into a deep sleep and waking up groggy. A good tip is to sit in a chair holding a pen in your hand, when you hit deep sleep, you will drop the pen and wake yourself up. Simple!

2) Eat protein or fruit, avoid sugary snacks and carbs
The usual staple of people hitting an all-nighter is crisps (potato chips), pizza and sweets. Whilst you might get a temporary boost, eating carbs just makes you sleepier and less productive. But you do need something to get through the night, so instead focus on eating mainly protein or fresh fruit if you need a sugar hit.

3) Be smart with caffeine

all nighter coding caffeine

Ok, so we’re not going to tell that energy drinks and coffee don’t work, because they clearly do. But to maximise their effects you should be smart with how you use them.

One tip is to stay off the coffee during the couple of days leading up to your all-nighter to deprive your body of caffeine and lower your tolerance. That way, when you do start on the coffee, the effects will be stronger.

It’s also a good idea to sip your caffeine drinks slowly over a period of time to keep the boost steady and to avoiding crashing. If you’re getting jittery, switch to a glass of cold water every 30 minutes. It’ll keep you alert and going to the toilet a lot is a good way of not falling asleep!

4) Exercise (a bit)
Still struggling to fight the fatigue? Time to cash in on a little evolutionary hack nature has provided us with. Doing a bit of exercise when you’re tired is a great idea, as it stimulates the brain and makes you more awake.

It all comes from when we used be chased by wild animals and our brains assume if we are exercising the we must be being chased and so falling asleep and getting eaten would be something of an evolutionary disadvantage.

Just don't go mad and run a marathon or something. That would be counterproductive.

5) Go somewhere cold
When you’re trying to stay awake, cold is your friend. First and foremost, make sure you’re working somewhere where it’s cold. Everyone knows it’s pretty hard to sleep when you’re shivering, so that’s a good start.

If you’re starting to crash, you can try splashing cold water on your face to wake yourself up. If that still doesn’t work then try closing your eyes and putting ice cubes on them. That’s a surefire way to snap you out of that slumber!

6) Go somewhere where your bed isn’t
Don’t code in bed or on the sofa. Sit somewhere upright and uncomfortable, like the kitchen table so you don’t accidentally drop off. Your bed is for sleeping, so stay away from it to avoid the inevitable mental associations and lose your focus.

7) Lower your screen brightness
To stop your eyes from straining, lower the screen brightness on your phone and laptop. Normally we’re advised not to expose our eyes to blue light before bed as it’s terrible for keeping our brain stimulated when we should be winding in down. In this case, keeping your brain stimulated can only be good, so knock yourself out!

8) Listen to loud music without any words
Finally, listen to some loud music to physically prevent yourself from falling asleep. We advise music without lyrics as words can sometimes be distracting, but clearly do whatever works best for you.

And that's it! Have we missed anything? I’m sure lots of you reading this have your own tips for pulling an epic all-nighter, so feel free to get in touch on Twitter or Facebook.

Are you a developer? Sign up with Techloop to receive job offers anonymously.