Saturday, October 29, 2011

How to create Gist to make snippet more powerful

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 flavor 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 dotnetspider.com, 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 from My Gist



  • 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.



    Following is the Gist :


    Benefits of Gits:
  • Version control
  • One roof for all snippets
  • No need to update the snippet whereever you use, it will be reflected with new code automatically.
  • Thanks for reading this article. Your feedback is highly recommendable.

    No comments:

    Post a Comment