How do you store your personal snippets database in order to use it everywhere (work, etc)? [closed]
Asked Answered
A

6

13

I've read the several discussions about storing code snippets but I did't find the info that I'm looking for, so let's define it:

  • At home, I have several side projects, most of them quite small, one large, and numerous little examples that demonstrate a specific language feature (for example, some template trick in C++).
  • Since I think that these examples will be useful to be available when I'm at work for a reference instead of trying to remember the exact details of this or that particular snippet that was tried and worked at home, I want to have it available for example on a USB flash drive.
  • The problem is that most of the snippets/small programs/examples are organized, written, compiled and tested in Visual Studio, it will be duplication if I have to put them in some code snippet organizer application. I can copy to the flash drive the source of the Visual Studio solution with all the examples, but it is not so convenient for searching compared with a dedicated snippet repository organizer. Or maybe I can change this if I write better comments and description of the examples, and that will do the job.

Any ideas, best practices, solutions, and experience with similar stuff are appreciated.

Approve answered 27/11, 2008 at 23:10 Comment(1)
I think this question should be moved to programmers.stackexchange.comAcademe
B
6

I keep everything in a source control repository, indexed by language. As I learn new languages, I translate some of my old useful stuff into the new language to learn how to do things in the new language.

Basilio answered 24/4, 2009 at 0:18 Comment(0)
S
5

I store my code within an online source repository - code.google.com, and use the web front-end to browse for the interesting bits.

Since it's on google, it's easy to search too..

All you'd need to do is organise the code into folders for each language, area, etc, and have them all within the same repository.

The only downside is that if you want to keep your snippets secret, then this won't work. Obviously, you'll need to be online to access this way, but you can easily do an SVN update intermittently to refresh any local offline copies you may need.

Sphery answered 28/11, 2008 at 0:51 Comment(0)
C
4

I find a Wiki is the perfect tool for keeping bits of info and code snippets.

Christan answered 27/11, 2008 at 23:36 Comment(0)
A
1

Not so much for snippets, but for common libraries that I've either collected or developed myself, I keep a folder called "_lib". Whenever I need something from that folder (eg: jquery.js, a CSS reset), I just symlink that directory into my working folder and hey presto! Alternatively, I just use svn:externals to bring it in to other projects.

Aggrieved answered 27/11, 2008 at 23:39 Comment(0)
S
0

I work in Visual Studio at home and at work.

I basically have all my code snippets in a folder that is synced to my Live Mesh. I then have each folder added to VS to enable it to auto-detect new snippets. Works like a charm for me :)

So, I create a snippet in Snippy, save it to my synced folder. Boom, works in VS with no additional configuration at all :)

Selfimportant answered 28/11, 2008 at 1:35 Comment(0)
G
0

Check out Snippets — code snippets manager that is available on Mac and Windows, supports sync and it's free. There is a feature called Distributors that allows you to re-use code snippets in your IDE or code editor natively. Here is a list of currently supported IDEs.

Gigantic answered 9/7, 2013 at 12:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.