

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

Hello all,<p>It&#x27;s been a while I ask myself this question :<p>How can I efficiently share snippets and&#x2F;or examples of code with my colleagues ? I haven&#x27;t encountered any good solution so far, but I must not be the only one to have this problem ?<p>My requirements would be :
  - versionning
  - tagging
  - private by default<p>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&#x2F;pointer but also to be able to easily discover if a colleague has already solved your problem on a different project.<p>So, are there any software&#x2F;service for that ? (It can be self-hosted if necesary)
======
atsaloli
Gists on GitHub:

[https://gist.github.com/](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.

~~~
Gmo
One of the problem with gists is that they can't be shared/accessed/listed
easily within an organization as far as I know.

------
beliu
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!)

------
rishabg
Don't know what you meant by tagging but Gitlab
([https://about.gitlab.com/](https://about.gitlab.com/)) has a snippets
feature that might fit the bill.

~~~
Gmo
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

~~~
sytse
GitLab CEO here, we're open to having someone add labels to snippets, feel
free to send a merge request.

------
lovelearning
A self-hosted WordPress blog supports search, tags, categorizing and
versioning (as post revisions) out of the box. Plugins can add code syntax
highlighting.

------
theaccordance
We either provide a link to the source code (if checked into github) or we
simply copy & paste into a DM on slack.

