Gists are the code snippets that you want to retain and share – with yourself and with others. Gists can be embedded in websites, blog articles and articles on Medium. Although used for snippets, all Gists are Git repositories, so they are automatically versioned, forkable and usable from Git. A gist is like a mini repo – it can contain multiple files.
I understood the value of gists, but the process of creating and editing them was a bit too cumbersome to my taste. Then I learned about the VS Code Extension GistPad – that integrates working with Gists in Visual Studio Code and that changed things quite a bit.
Creating gists is now no harder than creating file. Editing gists, saving changes and browsing through older gists – it is all very similar to working with local files. Gists on GitHub have become like handy files in a special folder on my laptop.
Gists can be secret (private, for my eyes only) or shared (public, for you too).
Once logged in to GitHub, all your gists show up as well as all gists you have starred. They can be sorted, grouped, opened – locally and on GitHub – and be edited. The Gists Url is available, the Gist can be starred and be duplicated.
You can copy images into a gist – from the clipboard . By default, when you paste an image, it is uploaded to a directory called
images within the gist. Gist comments are exposed within the editor at the bottom of any opened Gist files. If you want to follow a GitHub user, and easily browse all of their current and future gists , you can run the
GistPad: Follow User command and specify their GitHub user name.
In addition to being able to use Gists to share code snippets/files, you can also use it as a mini-blog, thanks to integration with GistLog.
As a bonus, in addition to managing gists, GistPad also allows you to create and edit GitHub repos without needing to clone anything locally.
Once a gist has been created, it can easily be embedded in an article such as this one. Open the gist on GitHub.
For (my) WordPress blog, copy the Embed snippet and paste it into the raw source of the article. For Medium, copy the Share URL and paste that into the article. In both cases, the article will show the content from the embedded gist.
Here is the result of this Gist embedded in this article:
VS Code Marketplace – GistPad – https://marketplace.visualstudio.com/items?itemName=vsls-contrib.gistfs