How To Find Code Sample That Can Help You

How To Find Code Sample That Can Help You

Before starting a new coding task, I find it’s usually worthwhile to spend at least a little time trying to find a related working example, especially when the task touches on unfamiliar libraries or concepts.

1 Like

This is an awesome article and loved the use of Google search filters for finding code on GitHub. A worthy addition to this article would be adding Sourcegraph’s universal code search as a resource for searching open source code on GitHub with language-specific filters and regular expression (heads-up that I’m the Developer Advocate at Sourcegraph).

Here’s a couple of examples:

Find splitChunks: https://sourcegraph.com/search?q=splitChunks+count%3A1000&patternType=literal#106

Find splitChunks only in JS and TS files, excluding code in node_modules: https://sourcegraph.com/search?q=splitChunks+file:\.js%24|ts%24+count:1000+-file:(^|/)node_modules/&patternType=literal

1 Like