GitHub Gist is the reflex. It is also, quite often, the wrong tool: it wants an account for anything non-anonymous, anonymous gists cannot be deleted by their creator once made, and everything you paste lives on indefinitely under a URL you will never revisit.
Most of the time what you actually want is narrower — get this block of text in front of one person, right now, and ideally have it not stick around forever. Here are five ways to do that, and the situation each one actually suits.
1. A no-login paste link
The lowest-friction option: open a paste tool, drop the code in, send the URL. No account on your side, none on theirs.
This is the right choice for the common case — a colleague is stuck, you have a twenty-line fix, and the exchange is over in five minutes. Look for a tool with readable URLs if you might need to say the link out loud on a call, and with an expiry option so the snippet does not outlive its usefulness.
Watch for: ad-supported paste sites often wrap snippets in display ads, and some gate longer expiry windows or private pastes behind a paid tier. Check before you rely on it for anything routine.
Doing it from the terminal
If the code is already in a file, a paste tool with an HTTP API saves the copy step entirely:
curl -X POST https://sharenotes.dev/api/v1/notes \
-H "Content-Type: text/plain" \
--data-binary @patch.diff
That returns JSON with a shareable URL. It composes with everything — pipe a failing
test, a stack trace, or git diff straight into a link:
git diff | curl -X POST https://sharenotes.dev/api/v1/notes \
-H "Content-Type: text/plain" --data-binary @-
2. A self-destructing note
When the snippet contains something that should not linger — a connection string, a staging credential, a token you are about to rotate — use a tool that deletes on a timer or after the first read.
Two cautions. First, "self-destructing" is not encryption: the content usually sits on someone's server until it expires, readable by whoever opens the link first. Second, burn-after-reading links are notoriously fragile in chat apps — the preview bot often opens the link before the human does and consumes the note. Test it, or prefer a short timer.
3. A real-time shared buffer
Sometimes the snippet is not finished. You are debugging together, the code is changing as you talk, and a static paste means re-sharing a new URL every time you touch it.
A tool that syncs live over a WebSocket fixes that: both of you keep the same link open and edits appear as they are typed. It is the difference between sending a photograph and sharing a whiteboard. Useful in a pairing session, a support call, or a classroom where one person types and a room follows along.
4. A repository branch or PR
Worth stating plainly: if the code is going to be reviewed, iterated on, or kept, it belongs in version control, not a paste. A throwaway branch and a draft pull request give you diff view, inline comments, CI, and history.
The tradeoff is setup cost and access — the other person needs to be in the org, or the repo needs to be public. For a quick "does this look right to you," that is a lot of ceremony. Use the heavier tool when the code has a future.
5. A code sandbox
If the point is for someone to run it, not read it, a browser sandbox (CodePen, JSFiddle, StackBlitz, Replit and friends) beats every option above. They execute the snippet, keep dependencies pinned, and let the other person fork and modify.
The cost is weight and lock-in: heavier pages, a service-specific URL, and usually an account if you want the thing to persist. Overkill for a shell one-liner; ideal for a reproducible front-end bug.
Picking quickly
| Situation | Reach for |
|---|---|
| Quick snippet, no accounts on either side | No-login paste link |
| Contains a credential or token | Self-destructing / view-once note |
| Code is still changing as you talk | Real-time shared buffer |
| Will be reviewed or kept | Branch and pull request |
| They need to run it | Code sandbox |
| Piping from a terminal or CI job | Paste tool with an HTTP API |
A note on what not to paste
Whatever you pick, the boring advice holds. Do not paste production credentials, customer data, or private keys into a third-party service, self-destructing or not. Rotate anything that does end up somewhere it should not. And assume any link you generate can be opened by anyone who gets hold of the URL, because it can.
How ShareNotes fits
ShareNotes covers the first three: a no-login paste with memorable URLs like
sharenotes.dev/blue-fox-42, syntax highlighting and a markdown preview;
optional self-destruct timers and view-once mode that survives chat-app link previews;
and real-time sync so a link stays live while you both work on it. There is a
free REST API with no key for the terminal case.
It does not try to be a sandbox or a repository — for those, the tools above are better. See sharing code snippets for the details.