Sample code can save hours or days. Some search engines for finding code.
Black Duck Koders:
With a very nice interface Koders is a very popular code search engine.
byteMyCode focuses on code snippets and code sharing. Easy to upload and share
In beta and limited to C, C++ and Java (just added). One benefit of the limited
(and syntactically similar) languages is that the search interface is specific to
these languages with search options such as Method Call, Method Definition, Class
Definition, Class Field, Variable, Field Reference and Free Text.
A very spartan search interface based on expressions (help page available). Many
DZone touts itself as "a public source code repository". Their focus is on code
Google Project Hosting:
Unfortunately Google Code Search has been shut down but
Google Project Hosting has quite a bit of useful code for their products.
In addition to code searches, Krugle also provides for searches of projects and tech pages
as well. Great filter options and a large number of languages supported.