Something to think about, instead of being on the computer before you go to bed, do something else. Computers are entertaining, thus, making your mind more alert and awake. Even though you may feel tired after getting off the computer, your mind is ready to go. When you fall asleep in class it means that your mind is tired. It's just like staying up late, except with your brain. O_o Try to limit your computer time to at least an hour before you go to bed. You may find it will help a lot.
Also, it won't work the first night you do it. You have to set your internal clock to get used to it. Make your brain tired. Read a book, draw, watch CNN... the last one was a joke. There are a million things you could do instead of being on the computer before bed. So, don't go telling me, "It doesn't work! I couldn't find anything to do!"
Happy trails,
FoxyMcCloud