DEV Community

Where/how do you save your code snippets?

Ghost on June 25, 2017

Collapse
 
armangungor profile image
Arman Gungor

Check out Quiver for Mac by HappenApps. Lets you mix text, code, Markdown and LaTeX. You can edit your code with ACE with syntax highlighting, etc.

--
Arman Gungor
Metaspike

Collapse
 
ben profile image
Ben Halpern

I've been on the fence about Quiver, I should just try the free trial already.

Collapse
 
nunez_giovanni profile image
Giovanni Nunez

I never log-in to comment, but felt like it was necessary :p

I love Quiver. Besides the stuff Arman mentioned, I love having a defined view for all my data.
I gave each language it’s own “notebook” and I use the tag feature that’s built in.

Collapse
 
t4rzsan profile image
Jakob Christensen

BitBucket.org has a "Snippets" feature where you can save any code snippet you want. Their web UI has code highlighting and they keep your code in Git. The snippet can be private or public.

Similarly, GitHub has "Gists".

Collapse
 
adambrandizzi profile image
Adam Brandizzi

To copy and paste? Nowhere, I always go back to the main source code. If I need a snippet many times in a row, my clipboard manager can handle it.

For sharing I use pastebin.com because I like the classics 😁

Collapse
 
jwmorse17 profile image
Joshua Morse

I have tried so many. I want three main things: first I want a web app, I am switching between multiple Win/Linux/MacOS machines multiple times a week and I want syncing and I don't want to deal with OS dependencies. second, want syntax highlighting, and last robust search. Quiver is amazing but is only Mac, Evernote doesn't have great highlighting, onenote kinda sucks in general. I have been using InkDrop recently. It does not have a web app, but it does sync across platforms.

medleytext.net/ is supposed to release a web app in July '17, so that is the next thing I am going to try.

Right now I just have a mess of notes in a few different platforms waiting for the right app. At this point I would pay good money for the right solution.

Collapse
 
jacobwallenberg profile image
Jacob Wallenberg

Sounds like you've thought quite a bit about this problem Joshua. Are you on MedleyText now? How are you finding it?

Collapse
 
dean profile image
dean

I love using Github's Gists. IntelliJ also has a way to upload a code snippet to a gist from within the IDE, which is an extremely useful feature! Great syntax highlighting support as well, and has edit history.

Collapse
 
josegonz321 profile image
Jose Gonzalez • Edited

GitHub Gist has worked wonders for me.

This is where I parked all my snippets. :)

F#:

JavaScript:

Elm:

Collapse
 
pavonz profile image
Andrea Pavoni

I use a git repo, I organize snippets in folders named with a given language or topic (it depends). Sometimes are source code files, other times they are in markdown format so that they can be easily read/exported.

I can then share it on github

As of today, it’s the cheapest/easiest way I’ve found.

Collapse
 
kapouer profile image
Jérémy Lal

gnome-gpaste is amazingly useful during the day - and doesn't require using the mouse.
Otherwise all code stays in projects:

  • very useful code goes into a npm module
  • (debian) server configurations tricks goes into a private github repository
  • credentials into a cryptfs partition
  • casual code stays where it's used - in its own git repository
Collapse
 
peiche profile image
Paul

Google Keep if it's something I just need to hang onto for a little while.
OneNote for work stuff.
CodePen for front-end stuff, especially when I'm working out a little block of functionality that needs testing.

Collapse
 
cheshireswift profile image
☕ツ

I don't, really. Any code that is useful I've either written myself for a project (in which case I check the source for the project), written myself for a one-shot script or similar (in which case I save the script) or found elsewhere (in which case I bookmark the elsewhere).

Anything too small to justify the effort of those, I'll probably just type out each time, not worth the interruption in flow to do otherwise.

Collapse
 
janux_de profile image
Jan Mewes • Edited

My code snippets are stored as blog posts in my personal space of our corporate Confluence instance.

Together with the keyword searches of Firefox (or custom search engines for Chrome) this works really well. E.g. I just need to type in "myspace bash parameters" in the address bar. This triggers the Solr based search in Confluence, filtered by my personal space. Then I can click on one of the first entries and copy over a template for the parameter handling into a shell script.

P.S.: The "Add block post" dialog can be stored as a bookmark.

Collapse
 
peterstoyanov profile image
Petar Stoyanov

I used OneNote but didn't like the lack of proper syntax highlighting and not good search options. I use a google drive folder which I sync across my devices and for looking stuff up I just keep it open wih Visual Studio Code. Nothing revolutinary but works for me.

Collapse
 
boudhayandev profile image
Boudhayan Dev

Hey,

Take a look at this - github.com/elvirbrk/NoteHighlight2016

This should solve syntax highlighting problem of onenote

Collapse
 
gabrielweidmann profile image
Gabriel Weidmann

Currently I'm using TiddlyWiki (a local Single-File-HTML-Wiki) for storing my snippets. There I can add a description, tags and additional information like example usages or whatever I want. It's accessible from everywhere if you put it on OneDrive or Dropbox.

With the help of additional plugins, e.g. Highlight.js, we also get syntax highlighting.

It's very easy to use and has a lot of great extensions to offer. In my opionion the most important features are tags, to keep the things organized without the need of an hierarchical structure, and the great and very-fast-to-use in-text search, to search for keywords in your snippets.

Collapse
 
cobes profile image
Dave Cober

That...is really cool.

Collapse
 
landonmiller profile image
Landon Miller

I was using Dash for a long time, but recently switched to SnippetsLab (renfei.org/snippets-lab/). I really like it, but I do wish it had snippet expansion like Dash.

Collapse
 
tomerbendavid profile image
Tomer Ben David

I started using it and it has the best search experience so far. my only issue with it is that I have only one .dash snippets file to track so i cannot have like dev.dash and maybe work.dash which I would want to split between work snippets and general dev snippets, may I ask what do you do about that?

Collapse
 
drubb profile image
drubb

I'm currently using Dropbox Paper, combining Markdown and syntax highlighting for documents in a convenient folder structure. Works for me.

Collapse
 
stoft profile image
Rasmus Larsson

+1 same here. Used to be Tomboy Notes + Ubuntu One but when UO went out of service I decided to switch to a system that would allow for migration to basically any platform and service.

Collapse
 
neex profile image
neex • Edited

Github Gist + GistBox App gistboxapp.com/

  • private
  • labels
  • search

Still not perfect, but best so far.

Collapse
 
ghost profile image
Ghost

I'm using the snippets feature from Dash.app.

Collapse
 
ben profile image
Ben Halpern

I've been meaning to try Dash, how do you like it overall?

Collapse
 
ghost profile image
Ghost

Dash is really good. Also the snippet feature.

The snippet feature is very plain. And because of that I like it. I hate tools which comes with an overload on functionality.

I suggest: Give it a try!

Collapse
 
nrobinson2000 profile image
Nathan Robinson

In my ~/projects folder, as a Gist, or on GitHub.

Here is my most recent snippet:
github.com/nrobinson2000/particle-...

Often my snippets turn into full projects.

Collapse
 
ben profile image
Ben Halpern

Gosh I wish I had a better system. Looking forward to reading about what other folks do.

Collapse
 
nakovdev profile image
Trajche Nakov

For a mac user there is a productivity app called Alfred: alfredapp.com/help/features/snippets/
and as a programmer the IntelliJ IDE.

Collapse
 
andy profile image
Andy Zhao (he/him)

+1 for Alfred, although I don't have the Powerpack yet so I can't attest to using the snippets feature. (oops)

Collapse
 
akmur profile image
Alex Muraro 🇪🇺

I use Evernote, the beta version has a basic code formatting feature. However it's just for reference and study, not for the workflow.

Collapse
 
rdeavila profile image
Rodrigo de Avila

I use Github Gists to public things (and some scripts I want to execute using curl commands), and a private gitlab.com repo (full of scripts/markdown files) for private ones.

Collapse
 
cosminlupu profile image
Cosmin Lupu

As a Mac user, I tend to use ClipMenu ( clipmenu.com/ ) for the clipboard history. They also have functionality for saving snippets in there, but I rarely use it TBH.

Collapse
 
jcserracampos profile image
Júlio Campos

I use Evernote.

Collapse
 
gearloosejones profile image
Gearloose Jones

Anything I find super-useful gets tossed into my public GitHub.

Collapse
 
chatelao profile image
chatelao

Winword

Collapse
 
nicetr profile image
Osman Erdi Balcıoğlu 🌃

boostnote.io/ is free to use. It looks like cacher.io and snippetlabs but it's free :) Moreover, backed by great community.

Collapse
 
ardennl profile image
Arden de Raaij

Github Gists + Cacher App (used to be gistboxapp): cacher.io/

Collapse
 
noghte profile image
Saber Soleymani • Edited

I've tried a few of tools mentioned in this thread. cacher.io (former GistBox) is best so far. Its free plan covers all the useful features and it's integrated with gist.github.com.

Collapse
 
clickrex profile image
Luke Merrett

A mixture of GistBox (Lets you label and manage GitHub Gists) and my own git repo full of larger scripts / ideas / odds and ends.

Collapse
 
david_ojeda profile image
David Ojeda

We store snippets/small scripts on Basecamp 3 since we like to keep as most things as possible in one single place. Really helps not switching between 10+ services.