Using Gist to make your snippet more powerful

In this whole article I am explaining how Gist which are GitHub repositories, are make our snippet more powerful and formatted. At the end of this article I will show how to create the one with live example.

What is Gist?

Gist are repositories of github. These can be created as Public or Private repositories.

This is the best way to make your snippet safe and available to all the world through a common url.

What is GitHub?

In April-2008, GitHub was launched. GitHub is nothing but Web Based Hosting Service, which provides you to create your own repositories of softwares etc.
GitHub is offering both Free and Paid accounts for 'Open Sources' projects In 2010 it named as 'GitHub Inc.'

GitHub which is running on the software has written in 'Ruby On Rails' To start with GitHub repositories you just need to install GitHub software :

  • Git for Windows
  • Git for Windows7
  • Git for Linux
  • Git for Mac

    Choose your flavour and start with Git. I will discuss in detail regarding GitHub in another post.

    What should I do to create Gist?

    Its as simple as you have created your own account in, following are the steps which are describing the answer:
  • Surf GitHub
  • Create you GitHub account
  • Supply your profile summary

    Now, you have ground to create Gist.

    How to create and Share Gist?

    As GitHub officialy defined Gist is :
    a simple way to share snippets and pastes with others.
    All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.

    Followings are the steps to create your own Gist:
  • Login to GitHub
  • Reach at : Gist
  • Here you can provide the two mandatory things :
    - Gist Description
    - Gist file name and optionally you can Select Language else language will be detected from file name extension
    eg. if you choose - myfile.cs - it will be considered as C# language Gist and so on...
  • You can write in the editor of Gist or can copy/paste your existing snippet
  • Now create Private or Public Gist by pressing specific button.
  • You can Add more files by clicking 'Add another file' link

    When you have done with creating you will be directed to Gist url link. By the same you can share your Gist through-out the world.

  • later on you can see your all Gits.
    Live Example:
    Follow the above mentioned steps and reach to your Gist home.
    In the following Gist, I tried to show a simple snippet "How to use Library from Console?"

    There are certain options by which you can compile files with different types like class library .dll or executable files .exe etc.

  • /t :exe - Produces a Console Application, which is the default option
  • /t :library - Produces a Class Library with its Manifest
  • /t :module - Produces a component but without manifest
  • /t :winexe - Produces a Windows application [not a console window]

    The above list is very limited to the scope of this article.

    With the help of switch option(s) you can do this.
    /t :library will generate the class library with its manifest
    and this will call at runtime. With the use of /r switch
    you can call the other class library file to any console application.

    Let's check the following example :
    In this snippet you need to format your code per dotnetspider 
    guidelines and if you want to reuse the same for some other
    purpose or to somewhere then you have to use their standards/guidelines,
    but with the help of your gist you just need to copy/paste your Gist url
    and rest will be handled by Gist itself

    Benefits of Gits:
  • Version control
  • One roof for all snippets
  • No need to update the snippet wherever you use, it will be reflected with new code automatically.

    Thanks for reading this article. Your feedback is highly recommendable.

  • Article by Gaurav Aroraa
    Gaurav is a Microsoft Technology Specialist professional. He has awarded lifetime membership from Computer Society of India (CSI). He has more than 13yrs of experience in the industry. Currently, he is working in the capacity of Solution Architect with an MNC. He is serving to the various communities since 1999.

    Follow Gaurav Aroraa or read 149 articles authored by Gaurav Aroraa


    Author: Mrs. Meetu Choudhary Nanda29 Oct 2011 Member Level: Gold   Points : 0

    Too Good Article Brother....

    Author: Shuby Arora17 Nov 2011 Member Level: Gold   Points : 1

    This is really very nice article Thanks for posting excellent stuff
    We are waiting for new article like this.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: