Here I explain how you can use GitHub to host your code snippets and how you easily add it to your site.
GitHub is a online project hosting using Git. Includes source-code browser, in-line editing, wikis, and ticketing. Free for public open-source code. you can easily add you code globally and can add it to your site as well as share directly.
Follow these simple step to add code snippets to blog:
Step 1 Go to gist(dot)github(dot)com
Step 2 If you already have GitHub account then Signin to your account else SignUp a new account with github (it help you to track all of your code snippets).
Step 3 You can seen fields for “Code Snippet Description”, “Name of File”, “Language of Code”, and field for you code snippet. Now fill all the fields according to need …
Description : Change active Class of navigation according to current tab URL on page load using jQuery.
Name Of File: Active Navigation Selector jQuery
Step 4 You have 2 options
- Create a Secret Gist
- Create a Public Gist
if you want to share your code block publicly then click on Public Gist else click on private