• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Any decent apps out there for storing code snippets?

Ranch Hand
Posts: 167
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Anyone know of any decent apps out there that one could use to store pieces of code we write that we can later reuse? I find myself scouring through old projects from time to time looking for some function I previously figured out, or some class that was - at the time - a stroke of genius lol ... but that search process can be a tedious one.  If I had an app that I could use where I see that I've written a class or something and realizing I may want to use it in the future, it would be nice to have all that in one place where I could categorize it etc.

I did some Googling around on the topic but I didn't find anything. I'm sure I'm not searching with the right verbiage.


Saloon Keeper
Posts: 22265
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose it depends on how you want it.

There are some web sites out on the Internet that specialize in code snippets, although they are often just brute-force scourings and frequently repetitive.

And of course, there's our good friend StackOverflow, which is another resource for code that's more or less ready-made.

One thing you can also do is make libraries out of your useful classes and store them in a local Maven repository such as Nexus. Pair that with an in-house source repository. I use Gogs, as it's easily run in a Docker container.

For personal snippets, there are resources in many IDEs. In particular, I keep both snippets and templates in Eclipse.

And for a simple roll-your-own free-text search, you might set up a directory tree on a fileserver and embed the snippets along with their documentation in markdown files. Then you could index them with a program such as Recoll. While I use recoll on my desktop, there's also a web UI that's usable for sharing a recoll database with multiple users.

And, of course, don't forget JavaDoc. It can be used to build websites from well-documented code.
Posts: 21972
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about https://gist.github.com/discover?
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic