Code Snippets: Where do I keep them?
Is there a tool or process for keeping your functions, selectors and 'for loops' handy and search-able for future use? I use nothing and am re-learning occasionally for a similar problem I've already solved.
background: I'm progressing into jQuery and Javascript and am starting to see some repeating patterns like building complex selectors, iterations to build JSON menus etc.
But I don't have a computer science background so I feel like I开发者_C百科'm missing some fundamental 'code library' part of my daily work.
For the ultimate in portability, nothing beats a plain text file with the snippets stored in it.
It depends on the tool you use. For example, if you use Eclipse, you can search for Eclipse snippets plugs. I use KomodoEdit, which comes with a great snippets tool already.
If you are using emacs as your development environment, use yasnippet
You can use Gist from Github https://gist.github.com/ to store your code snippets.
You can also keep them for yourself or share them publicly.
Good thing about Gist: free, online and option to share or not.
精彩评论