Blog posts and video from Steven as he “COMBS” through the minutia to discover tech, retro-computing, physical computing, gadgets and sci-fi.

retroCombs Playlist

Commodore Plus/4 Series

4 April 2016

HOWTO: Use Gist to archive and share code snippets

by Steven B. Combs, Ph.D.

This is a short post for those new to coding (Arduino, CSS, HTML, Python, Javascript, Ruby, etc). Lately, I’ve been reactivating my dormant coding skills. As I complete projects and tutorials, I often like to save my code, or snippets from the code, for future reference and recall.

To quickly access my code snippets, I use GitHub’s Gist service. Where GitHub is used for large coding projects (this blog is hosted on GitHub pages), Gist is the perfect tool to capture and share simple code snippets to archive language syntax, program flow or technique.

Gist provides tools to archive and share your code snippets either as a link or as an embedded object. As an example, below is an embedded Gist.

As you can see, the embedded Gist includes language based color syntax code and code numbering that make it easy to read and reference. Both tools are beneficial for anyone teaching and/or sharing code and code languages.

Create snippets by visiting the Gist page, clicking the New snippet button, copying and pasting the code snippet into a form field, selecting the code language and hitting submit.

After the code is published, you share the code by copying a small script that you can include in a blog post (see below) or share the URL to the script page to share in an email, text or other electronic communication.

Share a Gist

Use the URL below to create a free Gist account and get started:

To review my Gist collection, use the URL below:

Bonus Geek Tip: Use the following third-party tools to make access to Gist snippets faster and easier:

If you have a Gist account, let me know in the comments below. I’d be interested to read any tips you may have.

comments powered by Disqus