GitHub is a great way to store and share code, create websites and just collaborate with your peers and community.
But did you know about the other service that GitHub offers, called Gists?
It's something I discovered when I was reading Christos Matskas's blog a few years ago and thought it was a great way to put code snippets into your blog. Since then I've actually found it such a powerful tool.
The gist feature allows anyone to put code snippets in a easily readable, formatted away for people to grab and use in their own environment but that's not all that it can do.
Creating a Gist
The Gists you create can be publicly assessible or secret. So you can have little notes, or code snippets available to the community or just for you, for ease of use or as a great storage location you can access as long as you have an Internet connection. Although once you create a Gist as a public one you can't convert it to secret.
With gist's you can either use the GUI interface through a browser to create, interact and share or you can use something like Visual Studio Code and Git to interact with it.
From what I understand from the documentation and experience of using gist's you can only create them via the browser interface but once you have it created you can fork it or clone it just like you would with a Git repo.
Much like Git repo's people can star them or subscribe to be notified of changes.
As I mentioned above it's a create way of storing code you want to share in a blog post, or provide people with a copy and there is an Embed, option, where a piece of code will be generated that you can paste in your blog and it will show the code formatted in an easy to read format and easy to copy/paste format as well. (How many times have you copied code from a website and you've had to format tabs to spaces or change the capitalisation for it to work?)
If you can't see the above embedded code you can find it here.
GitHub supports a good number of programming languages, I think last time I saw some stats it was over 200 programming languages that it supported and gists are no different. You can create Gists with a PowerShell extension, Markdown extension, HTML extension and it will format it correctly for you.
Public or Secret Gist
As I mentioned above you have the option of having a public or secret Gist. It's worth noting you can easily share a secret Gist if you give someone else the URL to it. It's only secret if no one knows the URL.
I just love the flexibility of Gists, they allow you to share with others in a frictionless and versatile manner. The code snippet part is my favourite and means I don't have to worry about having a plugin etc within my blog that will format my code correctly.
Let me know how you use Gists and the value you've found!