This is probably your best friend. Other people's code. Once code was something people kept to themselves for fear of other people stealing their ideas. Well luckily the programming industry has changed a lot and now most devs release for public use all code that is not tied to any business secrets or patents. That means that in many cases you won't have to reinvent the wheel. At least not at first. Additionally, having other people's code to look at means you can learn from them. For example, Ruby on Rails (again, Ruby is the language and Rails is the framework), both are open-sourced technologies. So that means if you knew the programming language C (and even if you don't), you could look at the source code for Ruby! (right here: https://github.com/ruby/ruby) and Rails' source (which is written in Ruby) can be found here: https://github.com/rails/rails. This is pretty awesome. You can learn from the leading minds in the industry and see exactly how they write code, right now, for free! I don't know many other industries that are this open.
Later when you become a badass yourself (and with time you will), you could even hack those existing technologies. Don't like the way Ruby does garbage collection (look it up)? Adjust it to fit your needs! (Well that's an extreme example -- most devs don't need to touch Ruby's garbage collection...) Either way, you get the point -- OSS is brilliant. Use it correctly and don't abuse it. Meaning give a good word when it's deserved, share the software you like with others, or even donate some money when it's appropriate. Most importantly, try to open source your software when you can for other people to use and contribute some of your work to other developers projects. It'll force you to write better software (since it won't feel right releasing something shitty, I hope), it'll allow other people to collaborate with you, and it will become your portfolio as a developer! I still need to work on this point myself. But in my defense, it's been my New Year's resolution for the past three years.
Surely when you're developing I don't want you spending much time on building functionality that has been exhaustively built. There's no need for you to write a programming language to do what you want done. There's also no need for you to rewrite a background queue (to run processes in the background, duh). Those have also been done exhaustively and collaborated on by the best in the industry. And also don't waste your time writing carousels and lightboxes to showcase images on your site. Those have also been written by so many people that I'm sure you'll find one done better than you could even imagine. Just keep looking.
Or do reinvent the wheel. If you want efficiency, find someone else's work to fork (look it up!) on GH (GitHub) or implement however you want in your application. But if you wanna build it yourself, then do it. This is a great way to learn how to code -- building something that was built before. Want a good start? Make your own JS lightbox. You will learn so much about the web just by doing so. And the good news is that you'll have something that already exists to model your work off of. In case you get stuck, just look how other people have done it before you!