Code Share

Code Share

Share your code

Sharing code is the most common activity of developers.

We share code in several places online. We share it in public or private spaces. We share it to showcase, to explain, to debug, to collaborate, and to explore and discuss.

We share snippets of code and sometimes the entire code. We share it on social media platforms like Twitter, using online tools like Carbon, from editors like VS Code and executable tools like jsFiddle.

Let us look at some of these tools and platforms for code sharing.

Sharing Snippets

You have a piece of code that you would like to share, say on Twitter or WhatsApp. You want it pretty formatted and syntax highlighted. It's okay if the code cannot be copied. You are on your mobile phone and you want to post it ASAP. Here's what you can do.

Carbon

Head over to Carbon and paste your code in the box provided. Set your preferences and export. That's it! You have made your snippet and it is ready to be used anywhere you want.

Snappify

Not happy with what you got? Never mind. There's another one you might like. Try Snappify; it has all the bells and whistles.

Pastebin

There's also a Pastebin for Python you might want to try. It claims to give you a permanent URL the you can use to share your code.

If you are like me, a tech enthusiast, a trainer or a diehard learner, then you will often need to share code snippets, whether directly with your clients or on Twitter.

But there is a catch though. Your amazing code snippet cannot be copied when you post an image of it! What are my options? You will of course use plain text or HTML tags if the platform supports it. I use plain text on social media and Markdown or HTML in my blog posts.

Sharing entire code

When you are teaching or helping out a friend, you might want to share the entire code. If you can do it directly from the editor you are working on, it is simply the best.

VS Code is my favourite editor and there is a way you can share directly from there. You may try it with your own editor.

Here's how. Go to Code Share and start using it. Like it says on the home page -

Share code now. Share code for free.

GitHub Gist

I found this link very helpful and thought you might too. It is on JetBrains website.

Using gists to share code

TL;DR

Gists let you share code snippets, entire files, or even applications. You can also use gists to save and share console output when running, debugging, or testing your code.

Each gist is a repository that can be cloned or forked by other people.

Desirable features for a code sharing tool

  • Copy - definitely
  • Collaborate - useful feature
  • Run - executable preferably
  • Social media - paste on media
  • Website - paste on the web site
  • Blog - paste in the blog post
  • Syntax highlighting - necessary feature
  • Line numbers - useful feature
  • Signup - no signup to try
  • Price - low cost or free to try

Enjoy code sharing!