Ask HN: What do you use to share snippets of code with colleagues?

2 points by Gmo ↗ HN
Hello all,

It's been a while I ask myself this question :

How can I efficiently share snippets and/or examples of code with my colleagues ? I haven't encountered any good solution so far, but I must not be the only one to have this problem ?

My requirements would be : - versionning - tagging - private by default

Of course, there is always the possibility to host it in a git repository, but then, you miss the tagging which I think is quite important. The goal is to be able to share by just giving a link/pointer but also to be able to easily discover if a colleague has already solved your problem on a different project.

So, are there any software/service for that ? (It can be self-hosted if necesary)

8 comments

[ 2.8 ms ] story [ 36.8 ms ] thread
Don't know what you meant by tagging but Gitlab (https://about.gitlab.com/) has a snippets feature that might fit the bill.
By tagging I mean adding a bunch of tags describing for what the snippet is useful.

Exmeple : #js (more or less obvious from the filetype) #googlemapsapi for a snippet which would show how to use the google maps API

Then you would have a page with a tag cloud which allows to easily filter all the snippets (or that could be used in search).

Quite close to the way tagging works in stackoverflow for instance

GitLab CEO here, we're open to having someone add labels to snippets, feel free to send a merge request.
A self-hosted WordPress blog supports search, tags, categorizing and versioning (as post revisions) out of the box. Plugins can add code syntax highlighting.
Gists on GitHub:

https://gist.github.com/

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.

You get two buttons, "create secret gist" and "create public gist".

You can put your tag in the description. Gists are searchable.

One of the problem with gists is that they can't be shared/accessed/listed easily within an organization as far as I know.
Check out Sourceboxes. They are automatically linked (with jump-to-def), and you can embed any function/type or file range. (I'm one of the creators of Sourcegraph and would love to get your feedback!)
We either provide a link to the source code (if checked into github) or we simply copy & paste into a DM on slack.