What is a Gist?

Anyone who has been hanging around Github for the past few months has heard plenty of talk about gist, gists, and gisting. My investigations at gist.github.com lead me to believe that it was just a way to paste text or code onto the web, but I still had no idea what it was for, who would see it, or how it would be accessed. Here’s an example gist:

Picture_5

One thing that’s become clear to me is that I’m not half the hacker that any of the Github guys are, and as such, had no idea what a gist was. Well, when they opened their new support forums, I found it to be a good opportunity to ask the experts. I quickly received a response from tekkub:

If you hang out on an IRC channel for developers, you often find need to paste large blocks of code. Doing this directly in IRC is a very bad thing…

 But of course, there are other uses beyond that. Sometimes I toss handy snippets of code into gist so I can find them later if I need. It’s also great for sending error output to someone.

 
Well, that’s basically all there is to it. If you paste some code into their gist tool, it will format itself correctly and create a permanent URL which you can send to a collaborator or coworker. I had always just used campfire for this, but gisting seems to be the free, widely available version.
 
Github recently released an emacs mode for gisting as well. The above gist was created by simply highlighting the code in emacs and hitting M-x gist-region-private. It automatically created a gist at the url

https://gist.github.com/4219a1d1dd2e76539579

and copied that URL to my clipboard. Easy as that.
 
Thanks for clearing this up.

  • Rich

    Wow…no clue what you’re talking about. Sounds good though.

  • http://onqstudios.blogspot.com/ Kevin Queen

    So I just discovered Gisthub and I’m not into programming at all, however I need to understand the lingo or the jest of this at least.

    Am I correct in assuming that only those who are collaborating on a project together will know how the code is used and what it means?

    Any help you give me will be appreciated? I’m a photographer not a Gist User!

    • http://blog.dougpetkanics.com/ Doug Petkanics

      If the content of the gist is solely about something specific within a project, then yes, it will probably only be useful or relevant to the people working on that project. But oftentimes the content is meant to be shared publicly. For example demonstrating how to use a new library, or API. Or it’s meant to be embedded in a blog post. Or it’s fully commented with an explanation of what the code is intended to do.

      Either way…you’ll never really browse or discover gists without context. You’ll generally only be looking at them because someone sent you a link to one, or they’re embedded within documentation, an article, or a post. Standalone they don’t have a ton of merit.