How to focus better?

Dear Logan,

I have a problem with focusing on what I am doing like coding a website or learning a programming language. How can I manage my time so that the little time I do work I spend it correctly. Some days i spend eight hours coding and can focus and others I can't spend ten minutes working. 

What are some way that I could spend my time productively? What do you do when you can't focus and slack off? Do you play games, go on forums, or try an find inspiration? 

You could try adderall. Maybe a friend has some guy he knows who knows a guy and so on. It shouldn't be that expensive, just don't get caught. You'll become the smartest man your friends have every known. You can also drink lots of coffee and energy, they're really healthy and let you stay up for days!