Tuesday, July 12, 2011

The efficient way to share code snippets

Being a developer its not unusual to find yourself mailing code snippets to your colleagues or friends who might have rang up for help with their coding chores. So after Googling or trying out some samples you might straight away mail him the code, which is perfectly  acceptable at that point of time. 

Me too was doing the same thing while sending code snippets to my friends. One fine day, I encountered the same scenario which I had happened to solve for a friend of mine some weeks back. I remember the code was around 100 plus LOC with some hex values and bitwise ops. I was reluctant to code that again so I started searching in my send mail items, unfortunately I had deleted that mail from my send items as well as from the outlook recycle-bin; to make matters worse, calling my friend to whom I had send the mail was not reachable. It was like Murphy's law in action, after which I had to reinvent the wheel by coding all those again from scratch.

So as to find a solution to this, I turned to Google which ended up with Gist a handy feature crafted for the very same purpose by GitHub. The best thing with Gist is that its free and you could share the code snippets by sending the hyperlink to your friends. Before sharing your code snippets, create an account for yourself so that you can come back and see those code snippets shared by you; not only that the code snippets shared using Gist is indexed by search engines, which might help others too from reinventing the wheel.

No comments: