There are people who think that depression means 'feeling low', and that if you try hard enough, you can 'snap out of it'. These people are idiots. It's not a matter of being strong enough or dedicated enough. For me, like most people with depressive illnesses, there will be times when I just plain can't. In my worst states I can barely remember what a for loop does, let alone code one. Accept that there will be times when you can't work, and make the most of the times when you can.
There is an approach called "behavioral activation" that my psychiatrist taught me. Basically, instead of saying "I'll do it when I feel better", you say "I'll do it so I'll feel better".
Doing things I didn't feel like doing, that felt almost impossibly difficult (like putting on real clothes and going outside) was probably the most effective tool I've ever had with dealing with depression.