Menu Search
Jump to the content X

45+ Excellent Code Snippet Resources and Repositories


The beauty of code snippets is their ability to save you time when developing a site. Whether you keep a file with your own often-reused snippets or turn to one of the many online repositories, snippets can really speed up your site development.

There are plenty of places online to find code snippets and get answers to your coding questions. And many of these places let you upload your own snippets, either for personal use or to share with the community. They can also be a great place to find inspiration if you’re trying to figure out the best approach for any aspect of your site’s development.

Be sure to check out some of our previous articles:

1. General Snippet Repositories and Resources Link

The repositories and resources featured below cover multiple languages and platforms. Some have thousands of code snippets while others might only have a couple hundred. Most of them let you search by language, tag, author, or keyword. And most of them let you upload your own snippets or questions.

Stack Overflow6
Stack Overlow is a great site to check out if you have a programming question. Post your question and wait for answers. You and other users can then vote on the answers posted. You can also search questions based on keywords or tags, view unanswered questions, and sort by newest, oldest, featured, and other criteria.


Snipplr is a code snippet search engine. It’s a way for you to keep your code snippets organized and easily accessible from any computer. It includes snippets in JavaScript, HTML, PHP, CSS, Ruby and Objective C.


Smipple is a repository of “social code snippets”. You can browse by popular or recent snippets, save favorites, and submit your own snippets. You can also search based on keywords or tags.


Tipster, from Carsonified (the producers of the Future of Web Design conference), is a place to share and find tips from other web designers. In addition to searching tips, you can also view hot tips and vote tips up the charts.


Snipt is a code repository that allows you to save public or private snippets. There are snippets available in just about every programming language and web technology you could ask for. Some of the snippets are incredibly useful, such as prebuilt HTML test pages for creating your CSS.


DZone Snippets16
DZone Snippets is a public code repository that lets you tag your code and share them with others. They have tons of different categories, covering everything from JavaScript to Python to HTML to XML and just about everything in between.


Koders is a code repository with nearly 2.5 billion lines of open source code. The search engine they use is very powerful and allows you search based on a variety of different criteria, including by class, method, interface, and more.


Joyent CodeSnippets20
Here’s another public source code repository that lets you share your code or keep it private. Currently, there are more than 4,000 users sharing snippets. One of the nicer features of this particular repository is the ability to subscribe to an RSS feed of all snippets or just those tagged with particular keywords.


ByteMyCode splits up their snippets based on programming language. There are tags for CSS, HTML, MySQL, Java, PHP, and just about anything else you could think of. You can browse by tag, new snippets or top snippets, or search by keyword.


Refactor My Code24
This is a great resource if you want to get others to check your code for errors or inefficiencies. Just post some code, let other members know what you need help with, and wait for responses. You can also browse through “refactorings” and codes based on language.


Krugle is a powerful code search engine that lets you search either code, projects, or comments. Filters are available to refine searches based on language or where the term appears.


Naslu lets you search code in any language and from authors all over the world. One big advantage they offer is the ability to link code snippets into external web pages.


CodeCodex is a wiki-based code repository that lets members not only share code, but also improve code shared by others. It also lets users reorganize the library to make it more efficient and easier to find specific bits of code.


This snippet repository is hosted by Jonas John. It contains over 160 code snippets, primarily in PHP, though there are some in C#, Visual Basic, JavaScript and plain HTML.


Github offers a number of forked repositories in a huge variety of languages. You can browse repositories based on what’s popular, or search based on keyword, size, the number of forks, and more. Popular repositories include Rails, Scriptaculous, and MaNGOS.


Codase is a syntax-aware code search engine that understands code and, therefore, performs more accurate searches. There are currently more than 250 million lines of code in its repository.


Google Code Search38
This code search engine from Google lets you search public source code from across the web. The advanced search lets you search within languages, licenses, packages, files, and more.


Snipiti is a code repository and community. It focuses on cut & paste snippets in a variety of different languages, including PHP, HTML and Python.


Code:Keep is a repository of nearly 15,000 snippets in just about every language out there. You can browse or search, or even look up code based on an author’s email address (great for finding your own contributed code).


Snippetsmania is a small code repository that includes snippets written in C, Cobol, JavaScript, PHP, Perl and others. It provides a list of the most popular snippets and organizes other snippets based on language and date. There’s also a search option.


DevSnippets is an online snippet gallery that provides snippets as well as useful development articles for a variety of platforms and languages. Snippets are located off-site, generally on the blogs of their respective creators.


Server Fault48
Server Fault is a question and answer site aimed at IT pros and system administrators. It’s completely free and there’s no registration required. Just post a question and wait for answers. You can see how many times your question has been viewed, how many answers have been offered, and how many votes the question has received.


Refactory is a community-maintained collection of snippets available for public use. There’s no registration required to contribute. You can view snippets based on language or other tags (like “image” or “forms” or “anchor”).


Code Sucks Code Snippets52
Code Sucks offers a collection of CSS, JavaScript and PHP code snippets. There aren’t a huge number of snippets included, but those listed are useful and easy to understand.


2. Language- and Platform-Specific Repositories Link

The code repositories below are all dedicated to a single language or platform. These are excellent resources if you’re stuck on a certain function and the general repositories have failed you. They’re also a great place to keep your code snippets or share them with others who are more like-minded than general repository users. While most of the repositories here are small, with only a few dozen to a couple hundred snippets, there are some that offer more.

Django Snippets54
This repository contains snippets of code specific to the Django web framework. You can view snippets based on rating, tag, author, language, or how many times they’ve been bookmarked. You can also subscribe to a feed of the latest snippets.


Snyppets is a repository of Python code, mini-guides, recipes, links, tutorials, examples and ideas. They include basic code right up through advanced topics. The entire site is built on a single HTML page to make saving for offline reference easy.


PHP Snippets58
PHP Snippets is a repository of PHP code that you can browse by letter or based on function or class. You can also browse new and highly rated snippets.


This is a CSS repository that focuses on snippets for building grid and columb-based layouts. It doesn’t contain a huge number of snippets, but those it does include are very useful, and it’s easier to find what you’re looking for.


This site offers a huge repository of Visual Basic code snippets. You search by language (C#, Visual Basic, XML, or J#). It’s not a huge repository, with a little over 100 snippets, but it’s still a valuable resource for Visual Basic programmers, and it does let you add your own snippets to the site.


GreaseSpot Code Snippets64
This is a wiki-based site that serves as a repository for GreaseMonkey scripts. It includes a ton of useful scripts for everything from getting elements based on CSS selector to adding commas to numbers to forcing links to open in new windows and a lot more.


Code Beach66
Code Beach is a repository for Mac developers. You can find code available under a variety of open source licenses (though everything on the site has to be available for commercial use). They also have an open submission policy, so anyone can contribute snippets and classes without having to register.


Snippi is a repository for Magento code. Currently there are more than 60 snippets included, from a number of different contributors.


10 Code Snippets for PHP Developers70
This is a blog post covering ten useful code snippets. It includes an email address check, random password generator, get IP address, XSL transformation, force downloading of a file, string encoding to prevent harmful code, sending mail, uploading of files, list files in directory, and querying RDBMS with MDB2.


PHP Classes72
This is a PHP code repository that lets you search PHP Class Scripts, tutorials, and more. There are a huge number of scripts and snippets covering almost any aspect of PHP coding included. The site is mirrored all over the world and does require that you select a mirror before browsing.


The Code Project74
The Code Project has nearly 24,000 development and design articles, code snippets, and other resources available. It focuses on Microsoft-based and related languages like ASP.NET and C#.


SWT Snippets76
This is a huge repository of snippets for SWT (The Standard Widget Toolkit). Code includes snippets related to accessibility, browser functions, cursors, display, grid layouts, and more.


Ruby Snippets78
This is a small collection of Ruby and Ruby on Rails snippets from Arto Bendiken. There are snippets included for generating random passwords, simple RSS parsing, and determining image size, among others.


RubyForge Snippets80
Another collection of 176 Ruby and Ruby on Rails snippets and packages. Also take a look at the post 8 More Useful Ruby Code Snippets81 and A Selection of Ruby Code Snippets82.


DotNetSlackers is community and forum dedicated to ASP.NET. They also have a code repository that includes a wide variety of snippets in MS-based coding languages.


3. Other Code Snippet Resources Link

Here are a few other resources for finding code if the repositories above have failed you, for sharing your code outside of a repository, or even creating your own snippet or Q & A site.

Codefetch lets you search code snippets within programming books and makes it easy for you to then order the books that fit your needs. It covers a variety of different languages, including PHP, Java, Python, and Perl.


Snipt lets you store and then share your code snippets on Twitter and elsewhere. You can also search the Snipt repository or download the Snipt desktop app.


Cnprog is based on It was developed on Django and Python and allows developers to set up their own snippet repositories and coding Q&A sites.


Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91

↑ Back to top Tweet itShare on Facebook

Cameron Chapman is a professional Web and graphic designer with over 6 years of experience. She writes for a number of blogs, including her own, Cameron Chapman On Writing. She’s also the author of The Smashing Idea Book: From Inspiration to Application.

  1. 1


    Although a bit of information overload!

  2. 2
  3. 3

    worth to bookmarked. thanks for sharing..;)

  4. 4

    A Website Designer

    July 21, 2009 4:09 am

    No doubt each web developer will have their favourite amongst this vast list of code storage options.

  5. 5

    Grat list.
    What about offline snippet libararies? Any recomendations?

  6. 6

    GREAT GREAT post. I usually just kept the codes in Notepad, but I’m going to use Snipplr now.

  7. 7

    Ah, man, you’re missing JS Bin – live development sandbox and collaborative debugging environment (you can test/debug Ajax too!)

  8. 8

    these lists are great, but my big problem with them is always how they’re presented with the comments… the descriptions are usually very brief and often just blanket praise, which I’m sure is what the respective site owners want to hear, but what I want to hear is critical info… how good quality is the code? is it up to date? how much do they have? are they frequently updated? which of those sites has the most in general? how do they compare to one another? that would make this and other similar posts truly useful. Otherwise it’s basically just a fancy looking google search and I’m still not sure which of the sites are worthy my time. It’s a general trend on all these lists, and it is what’s currently holding this site back from being truly smashing.

  9. 9

    There’s also a desktop solution for collecting snippets that I’m really interested in, and think about purchasing even though I do have TextMate: Code Collector Pro.

  10. 10

    this is a very good roundup and worth a digg. my plan was to research in my delicious for those ressources and you made my job. great work, bookmarked

  11. 11

    Another very useful article. Thanx a lot, Cameron.
    BTW, the link for does not work.

  12. 12

    Just what I was looking for. Thanks, SM!

  13. 13


  14. 14

    Sweet collection! When first starting to learn PHP or JavaScript I lived off of smaller code snippets to learn how professionals did it, so articles like these are best for beginners trying to learn new languages.

  15. 15

    Great post. As usual… Thanks.

  16. 16

    woh – what a list.

    For ZendFramework Snippets look at

  17. 17

    Great post
    Thanks :)

  18. 18

    Anyone use any of these? if so.. recommendations?

  19. 19
  20. 20

    PHPclasses is very old and well know by developpers, just be suspicious on code.
    I know PHPclasses and Snipplr, they are ok. As usual, you must see and build your own opinion reading code but it’s ok

  21. 21

    Nice list, thanks.

    Also for using SilverStripe CMS there is

  22. 22

    George Litchfield

    July 21, 2009 3:42 am

    Great resource.

  23. 23

    adding Wordtaps web development and web design sharing powered by wordpress

  24. 24

    great article!

  25. 25

    Miguel Hernandez

    July 21, 2009 12:20 pm

    Thanks for this exhaustive list. While I knew about & used some of these, there were many that I did not know about. Very useful.

    Btw, the link is not working.

  26. 26

    Miguel Hernandez

    July 21, 2009 12:21 pm

    Ok, nm, must have been a hiccup. That url is working now. :)

  27. 27

    Jeez – information overload – I find it hard to imagine how anybody can digest all the information presented in these posts. That’s not a criticism, more of an observation; quite amazing stuff.

    It sometimes makes me think that being a web developer these days is more about knowing where to find information than using a brain :)

  28. 28

    i love stack overlow a lot..thanks for this wonderful post.. :)
    good work smashing

  29. 29

    Thanks smashing. It’s wonderful post. its amazing website ever seen. really beautiful.. smash rocks!!

  30. 30

    Us developers DO like our code snippets don’t we

    — Lee


↑ Back to top