Err the Blog Atom Feed Icon
Err the Blog
Rubyisms and Railities
  • “Huba Huba”
    – Chris on May 11, 2008

    It has eleven comments.
    Advertisement

    Surely, by now, you’ve heard of GitHub. (Don’t call me surely.) It’s totally the Indiana Jones of repository hosts. Feel free to stalk Pj and I to see what we’re up to. Blogging be damned!

    If you haven’t heard of GitHub, there are tons of posts explaining the hows and whys of its awesomeness. This is not one of the posts. Instead, I want to quickly share some oft overlooked but tasty GitHub tidbits.

    The GitHub Gem

    GitHub supports gems, which is cool, and also means we can install the official GitHub gem with ease:

    $ gem install defunkt-github --source=http://gems.github.com/
    

    Great. At this point, possibilities become reality. The gem has a few cool features, all of which are displayed via $ github -h, but the best feature by far is pull.

    Here’s how it works: I have my fork of technoweenie’s exception_logger. I’ve cloned it and am sitting in the working directory. Suddenly I discover ryanb (of RailsCasts fame) has sent me a pull request. Open source’s finest moment.

    So, I type $ github pull ryanb. A remote is added, a new branch is created, and Ryan’s changes are pulled into that branch. (It’s probably named ryanb/master.) I then review the changes and, if they rock, either rebase or merge them back into master. Like this:

    $ git checkout master
    $ git merge ryanb/master
    $ git push
    

    Already reviewed the changes on the web and know they’re legit? Just $ github pull --merge ryanb. This’ll grab the changes and merge them into master for you. Oh, right, you can also specify a branch. The assumption is master, but you know what they say about assumptions: you’re a jerk.

    Thus: $ github pull—merge ryanb weird_branch

    And just like that, GitHub pull requests are no longer a pain in the ass.

    But really, this is just start. Please please please fork the gem and add awesome features. github clone, anyone?

    Keyboard Shortcuts

    Let’s say you want to peep some Rails changes. In classic vi style, j and k navigate between changes. c, t, and p lead you to the selected change’s commit, tree, or parent. h and l navigate between pages.

    In fact, h and l will always go back and forward on any paginated page. We’ve written an evil twin which adds those hotkeys to any will_paginate call.

    Also cool: s. If you’re logged in, hitting s will display and focus the search bar. I use this one the most.

    Ranged Code Highlighting

    Clicking on any line number then shift clicking a higher value line number selects a range. Super useful for code discussion. Discussion such as, “Dude, nonzero? is so awesome. Check it out!” (People definitely talk like that.)

    Sweet.

    Keep Your Dotfiles in Git

    Okay, this isn’t strictly related to GitHub, but it’s good. You should be keeping your dotfiles in Git. Here are the steps to do so:

    1. Create a ‘dotfiles’ directory.

    2. Move your dotfiles to this new directory, sans leading dot. For example, to keep your ˜/.vimrc under version control, do this:

    $ mv ˜/.vimrc ˜/Projects/dotfiles/vimrc. Rinse and repeat as necessary.

    3. Add the following file to your dotfiles project, then run it: http://pastie.org/195036

    4. Finally: $ git init && git add . Then: $ git commit -m ‘new dotfiles project’

    You’re all set. Now your dotfiles that live in ˜ are symlinked to their counterparts in ˜/Projects/dotfiles. As a bonus, any time you git commit it will automatically git push. One of the entire points of keeping your files under version control is to back them up regularly.

    I push to a private ‘dotfiles’ repo on GitHub. Others have created public repos. Your call.

    For posterity’s sake, here’s my version controlled dotfiles:

    bashrc
    gitconfig
    irbrc
    railsrc
    sake
    screenrc
    ssh
    vim
    vimrc
    

    The best part?

    The best part about GitHub, f’sure, is all the outrageously cool open source projects hosted on it. _why’s stuff, the jQuery plugins and mirrors, all the LISP projects, newer languages like Io, and of course the assorted GitHub-related projects.

    Got something cool hosted there? Let us know.

    Til next time, keep on hubbin’.

    Update: GitHub Open Sores

    I just created the GitHub account and did two things: created and pushed up some extractions from GitHub itself (like the jQuery hotkeys plugin) and also forked all the projects that are used on GitHub which we’re using on GitHub. Dude, meta. Anyway, have fun with that.

  • The Comedy of Errors
    Every why hath a wherefore.
    • 72. Sugary Adapters
      Published February of 2008. Two comments.
    • 71. Adapting Ambitiously
      Published January of 2008. Twenty-five comments.
    • 70. Feeds for Free
      Published January of 2008. Nineteen comments.
    • 69. The jSkinny on jQuery
      Published January of 2008. Thirty-three comments.
    • 68. Paginatin' Christmas
      Published December of 2007. Twenty-five comments.
    • 67. Evil Twin Plugin
      Published November of 2007. Seventeen comments.
    • 66. View Testing 2.0
      Published September of 2007. Thirty-eight comments.
    • 65. Automatically
      Published September of 2007. Thirty-four comments.
    • 64. Even More Ambitious
      Published September of 2007. Seventeen comments.
    • 63. Full of Ambition
      Published August of 2007. Sixty-one comments.
    • 62. So, You Want Your Own Counter, Huh?
      Published August of 2007. Thirteen comments.
    • 61. Fixin' Fixtures
      Published July of 2007. Twenty-nine comments.
    • 60. Sake Bomb!
      Published June of 2007. Fifty-seven comments.
    • 59. Cappin' that Stat
      Published June of 2007. Fifteen comments.
    • 58. Jottin' to the Fullest
      Published June of 2007. Twelve comments.
    • 57. Kickin Ass w/ Cache-Fu
      Published May of 2007. Fifteen comments.
    • 56. I'm Paginating Again
      Published May of 2007. One hundred and thirty-six comments.
    • 55. Ya Talkin' Gibberish
      Published May of 2007. Forty-two comments.
    • 54. Be Dee Dee and Me
      Published May of 2007. Thirteen comments.
    • 53. Microformathingies
      Published April of 2007. Four comments.
    • 52. Nginx Config Like Whoa
      Published April of 2007. Twenty-one comments.
    • 51. Sexy Migrations
      Published March of 2007. Thirty-four comments.
    • 50. Vendor Everything
      Published March of 2007. Twenty-six comments.
    • 49. A Zoned Defense
      Published March of 2007. Eleven comments.
    • 48. alias_method_bling
      Published February of 2007. Ten comments.
    • 47. I Will Paginate
      Published February of 2007. Eighty-nine comments.
    • 46. RSSin' Your SVN
      Published January of 2007. Sixteen comments.
    • 45. Allow Me to Inject
      Published January of 2007. Ten comments.
    • 44. Select a Reject
      Published January of 2007. Eight comments.
    • 43. Captchator on Rails
      Published January of 2007. Sixteen comments.
    • 42. Rails Rubyisms Advent
      Published January of 2007. Twenty-seven comments.
    • 41. Real Console Helpers
      Published January of 2007. Five comments.
    • 40. Extend for Profit
      Published January of 2007. Sixteen comments.
    • 39. with_scope with scope
      Published January of 2007. Eighteen comments.
    • 38. SOAP in my Mocha!
      Published January of 2007. Seven comments.
    • 37. Pennin' a DSL
      Published January of 2007. Two comments.
    • 36. Rakie Pankie
      Published January of 2007. Six comments.
    • 35. Me and uFormats
      Published January of 2007. Twenty-one comments.
    • 34. A Ruby Rainbow
      Published January of 2007. Fourteen comments.
    • 33. My Rails Toolbox
      Published January of 2007. Forty-three comments.
    • 32. Cheat Again!
      Published January of 2007. Sixteen comments.
    • 31. Rake Around the Rosie
      Published January of 2007. Eight comments.
    • 30. OpenStruct IRL
      Published January of 2007. Five comments.
    • 29. Undefined what?!
      Published January of 2007. Five comments.
    • 28. Strut Your Structs
      Published January of 2007. Ten comments.
    • 27. Quickly: returning
      Published January of 2007. Fourteen comments.
    • 26. Content for Whom?
      Published January of 2007. Twelve comments.
    • 25. Memcaching Rails
      Published January of 2007. Eleven comments.
    • 24. irb Mix Tape
      Published January of 2007. Nineteen comments.
    • 23. submit_to_popup
      Published January of 2007. Nine comments.
    • 22. Sessions N Such
      Published January of 2007. Twenty-seven comments.
    • 21. Cheat!
      Published January of 2007. Thirty-six comments.
    • 20. Back Double At Ya
      Published January of 2007. Nine comments.
    • 19. Streaming Capistrano
      Published January of 2007. Three comments.
    • 18. Accessor Missing
      Published January of 2007. Four comments.
    • 17. Camping with Dr Nic
      Published January of 2007. Zero comments.
    • 16. Friday Hash Fun
      Published January of 2007. Three comments.
    • 15. has_many :as
      Published January of 2007. One comment.
    • 14. Composite Migrations
      Published January of 2007. Fifteen comments.
    • 13. Colored Tests
      Published January of 2007. Eleven comments.
    • 12. acts_as_textiled
      Published January of 2007. Thirty-five comments.
    • 11. Block to Partial
      Published January of 2007. Eight comments.
    • 10. case when else end
      Published January of 2007. Zero comments.
    • 09. Drop to IRB
      Published January of 2007. One comment.
    • 08. DRY Your Controllers
      Published January of 2007. Seven comments.
    • 07. ActiveRecord Variance
      Published January of 2007. Eight comments.
    • 06. Parse XML with Hpricot
      Published January of 2007. Three comments.
    • 05. Simpler irb
      Published January of 2007. Two comments.
    • 04. Auto-Patch Rails
      Published January of 2007. One comment.
    • 03. Organize Your Models
      Published January of 2007. Ten comments.
    • 02. rake remigrate
      Published January of 2007. Ten comments.
    • 01. Actions Are Methods
      Published January of 2007. Three comments.

Projects

  • Cheat! Sheets
  • Subtlety: RSSin' Your SVN
  • cache_fu
  • acts_as_textiled
  • mofo [microformat parsing]
  • require 'errtheblog'

Information

  • Dynamite! — The Err Free Weblog
  • Err Free: Ruby Development & Consulting
  • Err on GitHub
  • Err on Twitter
  • Report Err Plugin Bugs (Lighthouse Tracker)
  • Contact
This is Err, the weblog of PJ Hyett and Chris Wanstrath.
All original content copyright ©2006-2008 the aforementioned.