1. Not much free time to code besides job, family and life.
2. Not possible while coding at work. That stuff is just too random and boring to be exciting.
So I suppose to induce "productive mania" you could:
1. Get big chunks of free time.
2. Do stuff you are excited about. Do them because You want to and not because of some other goal (like getting money, attention, rewards etc.).
I manage to get that for very small scripts that I program in order to get some small things done for me personally. Those things (I hesitate to call them tasks or projects) are always done quick, work like a charm and do exactly what I need. It gives me a good feeling.