Gists are Awesome

After an esteemed colleague sent an article about someone using gists as task lists, I thought it was about time that I publicly profess my love for the gist.

Gists are more or less limited Github repositories. According to GitHub, a gist is:

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 from Git.

A gist really excels when you need to share code with someone else. You pick up a lot of the benefits of normal repositories in addition to having it be highly disposable.

Creating a gist is as simple as going to gist.github.com and adding your content.

Forking

One of the differences between a gist and a full repository is that a gist that I create cannot be pushed to by you. Of course, you can clone it and commit locally, but when you try to push you’ll receive an error. This is regardless of whether the gist is private or public.

If you want to alter another persons gist, you must fork it and then clone & push to a gist that you own.

Clone, Pull, Push

In addition to the web interface, you can interact with gists through the command line.

# Clone a gist via SSH
git clone [email protected]:db53f70d54055e3fe5f3.git gists_are_awesome

Now if we change anything in that gist, we can push it back to GitHub.

# Commit the change
git commit -a -m "Updating post."

# Update gist
git push

Branches

You can also create branches (and push them to back to Github). I did a little bit of experimenting for this post and it doesn’t appear that you can view any branch other than master on the web interface. With that said, those branches are still available when cloning the gist.

# Make the branch
git checkout -b test-branch

# Push it
git push

Further usage

While I like the ubiquity of the web interface, I find having to open a web page an unnecessary step if the right tools are close at hand.

IDE

If you use Sublime (2 or 3) another wise move is to grab the gist plugin. Once it is setup, you can create a gist from a file or selected text in 2 keystrokes. The gist URL is copied to your past buffer automatically too. I find this makes sharing code a life saver.

Command line

I highly recommend grabbing the gist Ruby gem. It works both on the command line and in Ruby programs. I’m not a Rubyist – so I use it primarily on the command line.

Do you have any interesting ways of using gists? I’d love to hear about it.

Awesome Web Development Links Found This Week

I’ve come across some really interesting articles this week. Here’s a quick list of things I’d highly recommend spending a few moments reading this weekend:

  • International Freelancer’s Day – Sept 24-25, 2010
    • A free online conference, the only requirement is a quick registration. The thought of listening to “social media experts” is much out weighed by hearing Mike McDerment (of FreshBooks) speak.
  • EtherCodes - EtherPad for programming
    • Should be live at 2pm EST today.
  • Fixing Common Browser Issues: Dealing With Key Events
    • I’ve had this nagging issue with a key event, this helped shed a lot of light on it.
  • Css3 Generator
    • Even with all of the CSS3 resources available, I still found this to be to the point and helpful.
  • Everynote Site Memory – Another sharing button
    • As an Evernote user, I like the way you can customize this. You, the site owner, may select which parts of your page are clipped. You can even suggest which tags the resulting note gets!

Taggable Demo Video

In the comments of my last post on Taggable, John F asked to see a video of Taggable in action.

I felt like the example I created for the original post wasn’t very exciting, so I created one better. This demo shows how it could look if you used Taggable to save tags on the server as the users interacts with items.

Enjoy!

New jQuery Plugin: Taggable

Summary for the busy

Motivation

I’ve really enjoyed using jQuery over the last few years. It’s been quite wonderful really. Outside of the core being easy to use and very solid, the plugins available really make jQuery sizzle.

So I thought I’d take a crack at writing my very own plugin. My main goal was to imitate the tagging interface you’ve seen in some desktop UIs, with Evernote being my main inspiration.

Lessons Learned

A few things I learned while writing the plugin:

  1. Writing a jQuery plugin is not that hard
  2. Developing jQuery plugins is  really really fun (no really, it is)

Details

The plugin requires jQuery and jQuery UI. Once you have the jQuery requirements and the plugin file, using the plugin is simple. Just call .taggable() on the element that you want to have tags attached to. There are various ways to customize it beyond this of course. For those details, check out the README.

Other Tag-ish Plugins Out There

I fought the urge to look at existing work, mainly so that I could learn as much from tripping over my own two feet as possible. Upon writing this post, I decided ‘why not’ and Googled around for “jquery plugins tag” and other permutations. I was thrilled to see that it doesn’t look like there are any other plugins that do quite this. All of the other options turn input into tags or create tag clouds.