As a long-time sufferer of a circadian irregularity, and as a procrastinator who spent many a sleepless night doing last-minute projects, I consider myself adequately qualified to give advice on the subject. The only real medical advice in this node are things I was told by my doctors.

Oh, and just to be clear, my definition of an all-nighter means you can't afford to crash the next morning, at least until school/work is over, meaning you'll be awake at LEAST twenty-four hours. Here goes:

  1. Keep your mind awake. Don't listen to soothing music. Don't watch anything relaxing or boring on TV. Don't do anything passive. An inactive mind winds your body down and prepares it for sleep. Keep yourself stimulated - exciting music and movies, exercise, your own determination and inspiration, or doing anything you enjoy that requires concentration like playing guitar, a computer game, or something creative.
  2. Environment. Keep the lights on - darkness prompts hormones that tell your body to sleep. It's best to keep yourself a little chilly, too. If you can't make the room cold, try drinking something or taking a cold shower. Warmth will lull you to sleep. Don't let yourself get too comfortable, sit in a stiff chair and keep good posture. Working in a comfy chair or on your bed is just a step away from my favorite line, "I'll just lay down for a second," and you know what comes next.
  3. Eat. Drink. Your body needs carbohydrates to keep moving. Staying hydrated decreases the pang of that deep chest pain some get when their body absolutely demands sleep. As for WHAT to eat, picture anything in the huge "breads and cereals" group at the bottom of the old food pyramid. Proteins are good, too. Avoid fats and sugars.
  4. Drugs. The most obvious, of course, being caffeine and sugar. There are other drugs that hinder the mind's desire for sleep, but most of them aren't appropriate for someone who plans on getting work done overnight. The problem with drugs is the crash, which is where most people fail when trying to pull an all-nighter. There's no way to prevent it, but it is possible to optimize your intake to soften the blow. Don't resort to caffeine or high amounts of sugar until you're getting desperate. Crashing in the middle of class sucks, but it's better than crashing halfway through writing your paper. Save the crash for when you can afford to doze off, or have something else (like an angry teacher) to keep you awake. Moderate yourself, taking it a bit at a time throughout the night.
  5. Do not take naps. People often disagree with me on this, but in my experience attempting to take short naps usually ends with me waking up six hours later grumbling, "Fuck, fuck, fuck!" as I desperately shuffle my papers together and dash to class. However, it seems to vary person to person. Some people are quite skilled at the power nap. Know thyself.
  6. Set your alarm anyway. People fuck up. If you somehow let yourself fall asleep during the night, this will always be there to make sure you get to work on time, even though it may be hard to face your boss with the half-finished work you fell asleep doing.
  7. Sleep in the next day. Sounds obvious, but you'd be surprised how easy it is to just fall back into your regular sleeping patterns and forget about the night before. Once you're over the hump, it feels like a regular day. Give your body a break, losing sleep regularly will catch up on you.

Just as a note, and to help the fellow sleepless, keep in mind that depriving yourself of sleep is, well, bad for you. If sleep loss starts to affect your life, give melatonin a try. It's excellent for mild to moderate sleep disorder sufferers.

The worst thing is... I'm writing this node in the middle of an all-nighter. In addition to being nocturnal, I'm also a fan of irony and a hypocrite.