查找代码
A recent thread on SitePoint’s forums discussed how best to learn from other people’s code. For many people learning by example is the optimal way to pick up a new programming language, idea, or technique. But finding that ideal piece of code to look at and learn from isn’t always easy. That’s where code search engines and snippet libraries come into play.
SitePoint论坛上的一个最新话题讨论了如何最好地向他人的代码学习。 对于许多人来说,以身作则是学习新编程语言,思想或技术的最佳途径。 但是,找到理想的代码来学习和学习并不总是那么容易。 这就是代码搜索引擎和代码段库发挥作用的地方。
The seven listed below are the top places we could find that will help you locate the piece of code you’ve been looking for. But as always, if we’re missed any, please let us know in the comments below.
下面列出的七个是我们可以找到的最重要的地方,它们可以帮助您找到所需的代码。 但是和往常一样,如果我们错过了任何事情,请在下面的评论中告诉我们。
Popular open source code repository and version control web service GitHub launched a new Code Search feature today. Even though it’s the new kid on the block, GitHub has become super popular in a very short space of time and hosts a ton of public repositories. In a blog post, GitHub’s Scott Chacon classifies the amount of code searched as “a lot.”
流行的开源代码存储库和版本控制Web服务GitHub今天启动了一项新的代码搜索功能。 尽管这是个新手,但GitHub在很短的时间内变得非常受欢迎,并托管了大量的公共存储库。 在博客文章中 ,GitHub的Scott Chacon将搜索到的代码量归类为“很多”。
Krugle claims to search over 2.5 billion lines of open source code, making them one of the largest source code search engines on the web. They claim to reach over a third of all developers world wide, and their enterprise search product powers code search for Amazon Web Services, IBM developerWorks, Collab.net, SourceForge.net, and Yahoo! Developer Network.
克鲁格声称可以搜索超过25亿行开放源代码,使其成为网络上最大的源代码搜索引擎之一。 他们声称可以覆盖全球所有开发人员的三分之一,他们的企业搜索产品支持对Amazon Web Services,IBM developerWorks,Collab.net,SourceForge.net和Yahoo!的代码搜索。 开发人员网络。
Koders, which claims to search over a billion lines of code, seems to be a favorite among Ruby programmers. In a press release announcing the company’s acquisition by Black Duck Software last month, the site revealed the Ruby searches were up 20-fold over the past four years and have passed PHP, Perl, and Python. Ruby is now the fourth most searched for language on the site behind only Java, C/C+ and C#.
Koders ,到十亿行代码搜索过哪些权利,似乎是Ruby程序员的喜爱。 在上个月宣布该公司被黑鸭软件公司(Black Duck Software)收购的新闻稿中 ,该网站透露,过去四年来,Ruby搜索量增长了20倍,并且已经超过了PHP,Perl和Python。 现在,Ruby是网站上搜索量排名第四的语言,仅次于Java,C / C +和C#。
Codase is the little guy on the block, weighing in at just 250 million lines of code searched, according to the site. That might be because development on the search engines appears to have stalled a couple of years ago. Codase focuses mainly on Linux C/C++ open source projects and appears out of date, so unless that’s what you’re looking for, there are better options out there.
据该网站称, Codase是街区上的小家伙,仅搜索2.5亿行代码。 那可能是因为搜索引擎的发展似乎已经停滞了几年。 Codase主要关注Linux C / C ++开源项目,并且过时了,因此,除非您一直在寻找,否则会有更好的选择。
With over 13,000 users contributing to over 5,000 code snippets, the DZone Snippets library is a great place to find good code examples. It’s certainly not the easiest site to browse, but there is some gold hidden for those who look. Exercise patience and you may find exactly what you need at DZone’s site.
DZone代码段库拥有13,000多名用户,贡献了5,000多个代码段,是查找良好代码示例的好地方。 当然,这不是最容易浏览的网站,但是对于那些看在眼前的人来说,隐藏着一些黄金。 保持耐心,您可能会在DZone的站点上找到您真正需要的东西。
Snipplr is a nicely designed code snippet library that has less users than DZone (just under 10,000), but more code snippets to crawl through — almost 8,000. And it seems to be gaining steam — more than half of the site’s snippets were added in the past year, even though the site is over 2 years old. Oh, and they have handy plugins for Textmate, Gedit, and WordPress, and bookmarklets for Firefox and Safari. Very nicely executed.
Snipplr是一个经过精心设计的代码段库,与DZone相比,用户数量较少(不到10,000个),但可供爬网的代码段更多—接近8,000个。 而且它似乎越来越流行-在过去的一年中,超过一半的网站片段是添加的,即使该网站已有2年以上的历史了。 哦,他们有用于Textmate,Gedit和WordPress的便捷插件 ,以及用于Firefox和Safari的小书签。 执行得很好。
Last, but certainly not least, is Google Code Search, the grand daddy of all code search engines. While the people at Krugle and Koders may argue the point, and Google doesn’t say how many lines of code they’re searching, when you’re talking search, Google is always the team to beat. Their code search engine searches a ton of public source code repositories — including GitHub, Sourceforge, and their own Google Code site. And Google supports a ton of languages.
最后但并非最不重要的是Google Code Search ,它是所有代码搜索引擎的祖父。 尽管Krugle和Koders的人可能会争论这一点,而Google并没有说他们正在搜索多少行代码,但是当您谈论搜索时,Google总是可以击败的团队。 他们的代码搜索引擎搜索大量的公共源代码存储库-包括GitHub,Sourceforge和他们自己的Google Code网站。 而谷歌支持一吨的语言。
BONUS: O’Reilly Code Search: Book publisher O’Reilly lets you search over 123,000 examples covering over 2.6 million lines of code taken from their books. Almost 700 of them.
奖励: O'Reilly代码搜索 :图书发行商O'Reilly可让您搜索超过123,000个示例,涵盖从其书籍中提取的260万行代码。 其中将近700个。
翻译自: https://www.sitepoint.com/7-places-to-find-the-code-you-need/
查找代码
相关资源:2. Python是如何找包的,Python安装的包放在哪里.