1) go to any code on github
2) click on the "commit" link for any changeset
3) add ".diff" to the url
4) now copy the url and voila:
curl [url] | patch -d [dir]
e.g.
curl http://github.com/rails/rails/commit/268c9040d5c3c7ed30f3923eee71a78eeece8a8a.diff | sudo patch -d /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails
So easy!
(courtesy of http://www.mattvsworld.com/blog/2010/03/version_requirements-deprecated-warning-in-rails/ and http://www.kartar.net/2009/09/output-github-commits-as-unified-diffs/)