How to share code online in real time

·3 min read

Sharing code with someone else is a solved problem right up until you try to do it quickly. Chat apps mangle indentation, screenshots cannot be copied, and a pull request is far too much ceremony for "can you look at this function?".

A shared editor link fixes the small case: you open a page, paste your code, send the link, and the other person sees it immediately and can edit alongside you.

How a shared editor works

  1. Open buddysend.com/code. A new pad is created for you.
  2. Paste or type your code, then pick the language for syntax highlighting.
  3. Copy the link and send it to whoever needs it.
  4. They open the link and can read and edit the same text you are looking at, as you type.

There is no sign-up, and the pad works in any browser. Everyone sees the same content, so you can talk over the phone while both of you look at it.

When a shared pad beats the alternatives

Instead of pasting into chat. Chat strips formatting and wraps long lines. A pad keeps indentation and highlights the syntax, and stays readable when the snippet is 200 lines.

Instead of a screenshot. Screenshots cannot be copied, searched, or edited, and they are unreadable on a phone. They also hide the parts of the file just off screen.

Instead of a gist or paste site. A gist is good for something you want to keep and refer back to. A pad is better when you both need to change the text during a conversation, because edits appear live rather than after each save.

Instead of a screen share. Screen sharing shows your code but nobody else can touch it. In a pad, the other person can fix the typo themselves.

Good uses

  • Interviews. Send the candidate a link, watch the code appear as they write, and discuss it as you go.
  • Debugging together. Paste the failing function and the error, and let a colleague edit it in place.
  • Teaching. Write an example live while students follow along in the same document.
  • Config files. Hand over a YAML or JSON block without a chat app breaking the indentation.
  • Quick handover. Paste a query or snippet for someone who is not in your repository.

Practical tips

  • Set the language first. Highlighting makes review far easier, and there are more than 25 languages available.
  • Use a memorable link. Opening a named pad such as /code/standup-notes creates it on the spot, so you can agree a name over the phone.
  • Say what you changed. Live editing is silent, so a quick "I fixed line 12" avoids confusion.
  • Keep secrets out. Anyone with the link can open the pad, so strip API keys, passwords and customer data before pasting.

How long a pad lasts

Snippets expire after 7 days, which suits the way pads are used: a conversation, a review, an interview. If the code matters beyond that, move it into your repository or a gist, because a pad is not storage.

A word on privacy

The link is the key. There is no password on a pad, so treat the URL as sensitive while you are working, and do not post it publicly. When the content is genuinely confidential, use your own tooling rather than any public pad service, including this one.

Files rather than code

If the thing you need to hand over is a file instead of text, the same idea applies with a 6-digit code: upload it, read out the number, and the other person downloads it. That is covered in Share large files in seconds with just a 6-digit code.

Try it with your own file

Drop in a file and you'll have a 6-digit code in seconds.