Ex-Amazon Engineer Builds Library for World’s Software Code article mentions and interesting service: Runnable. Companies like Amazon and Google try to share their code with every other engineer at the company. The idea is to ensure that they never build the same thing twice. This kind of practices have created a huge discovery problem to find the right piece of code from the ocean of code pieces. In building software, modern companies rely also on all sorts of code and tools they don’t develop themselves (open source software and APIs).
The open source search engine Ohloh spans 20,656,731,705 lines of publicly available code, and the API tracking site The Programmable Web lists over 10,000 publicly available APIs. You can also found code from GithHub and BitBucket.