I program in spurts of 15-20 minutes throughout the day for a total of about 4-5 hours. If you're not employed in a traditional sense I find it best to write your code when you're in a super motivated, super stoked frame of mind because you'll write better code and have more fun doing it.