Try to inject something new into what you're doing. It might be mundane and repetitive but try to figure out something new which you can inject as a learning experience.
Of course, I only do this after finishing the original task. Sometimes, it's possible to work up prototypes in your favorite other language before starting the main task. This often leads to better code (i.e. less code).
Goes full circle to … work sucks!