Well, I think alexanderdmitri's advice of looking for answers to coding problems on places like Stackoverflow is great advice and I'd like to expand on it a bit.
It's easy to get sucked into a coding problem and fight with it for days like it's a personal challenge to your abilities. That can turn into a habit. It did for me. Screw that. Admit you have a problem and then get over it.
The goal of working is to produce something, and not necessarily, or even very often, to invent something new or even invent a new way of doing something. Coding is no different.
The truth is for most of us coding is more often akin to assembling something even when you're designing and building something new. That's how I approach it anyway.
When I switched from coding mainly Perl to Javascript I learned (the hard way) to start searching for answers first instead of banging my head on my desk for hours (even days) over what were often times really just syntax issues or things that already had boilerplate solutions publicly available.
Learning to search for answers first made a huge difference in my productivity and in how much I enjoyed coding. Getting stuff done provides a sense of accomplishment and we all need that to inspire us to keep working.
And it's made me a better coder too. I have learned so many new and better ways to do things, as well as how not to do them, and found great explanations on the "whys" and "hows" in the process. And I learn them when they're relevant to what I'm working on too, not in some abstract way that is easy to forget or dismiss.
The truth is there is way more to learn about coding than we can possibly learn already and that gap is constantly expanding. That's really a great thing though because learning on a need to know basis makes it so much easier to get stuff done. It lets us focus on one problem at a time and not worry about what comes after. We can learn what we need when we get there and by then there might be a new and better way.
When I first started making a habit of searching for answers and example code for how to do something I was amazed a few times to find an answer. Now I'm more surprised when I don't find one easily.
To me, that's what a "hacker" is in the truest sense. You find and write and hack together code. There's nothing wrong with that. It's why we have "open source" code and in fact it's truly awesome.