Hi, please

Using Gist.Github for collaborating and comparing code snippets

We talked about it briefly this week in class, gist.github.com allows you to post code, have it be highlighted and allow others to edit that code. Here’s how you can use it:

The input form at gist.github.com

  1. Name your file, this will help you keep record of your work and if you include the file extension (like .html / .css / .php) Gist will already do step 2 for you and highlight the text correctly.
  2. If you have not specified the file extension you can simply choose the language from this drop down menu to let Gist know how do you want it to highlight the code.
  3. Paste your code in directly from your text editor. Try to indent it well and keep it clean and tidy so it’s easy for others to read and possibly collaborate on it.
  4. If you save it as a public gist everyone can go in view it and edit it. Don’t worry, your original revision will be saved anyway.

    The gist after the initial posting + 2 edits (using the Diff for gist.github userscript)

    The gist after the initial posting + 2 edits (using the Diff for gist.github userscript)

  5. The Edit button will allow you to edit the code and save it as a new revision.
  6. You can download the code
  7. Enter a short description for what this code is supposed to do or even what is the problem you’re running into
  8. You can embed the code in our blog by grabbing the embed code and pasting it in the HTML tab of our post editor.
  9. The sidebar lists all of the revisions on this gist so you can browse through them (and no version is ever completely erased by the other – like in wikis)
  10. This is an extra – it is not (yet) a feature of Github and requires you install the Greasemonkey plugin for Firefox (which allows to run Javascript hacks on the page to extend the functionality of existing websites) and then install the Diff for gist.github userscript which will add checkboxes next to the revision list and allow you to compare them line by line (very useful).


Post a Comment

You must be logged in to post a comment.