Do you know how to share a touch of code?
22/04/2017 5:01 AM by
Any regular blogger who writes about code knows that embedding code snippets into their posts can be a real pain!
Syntax highlighting, special tags and keeping a track of your code snippets can be a nightmare. As a developer, you're sold on the virtues of source control, making changes then rolling back, forking, and cloning code. Wouldn't it be great if there were a simple way to share a touch of code?
- Figure - Using images for code snippets is difficult to maintain.
Introducing Github Gists, which makes sharing, embedding and keeping track of code snippets easy. The standout feature of Github Gists is that every code snippet (often referred to by GitHub as a Gist) is behind the scenes a Git repository, which in turn gives you access to all of the benefits of source control.
Upon editing an already published Gist, the previous versions are preserved. As to be expected with any good source control, you can use the built-in diff engine to highlight clearly the changes between any two versions of a single Gist. This sounds like it can get out of hand quickly, but you can easily view all your Gists by heading to https://gist.github.com/<username>/.
- Figure - Easy to review your Gists.
Do you feel this rule needs an update?