GitHub Rebase #1

This is the start of a new weekly column that going to recap some of the action that’s been happening on GitHub during the past week. My goals with this column include:

  1. Prove that Git is a great choice for version control!
  2. See how active the community at GitHub really is and what they’re working on.
  3. Show how Open Source development is truly open.

Using the magic of feed-normalizer, hpricot, and gchartrb, I’ve created a little Rails app (dubbed Rebase, of course) that I can use to rip all of the events that are going on at GitHub. I’m going to try to keep the format of the column consistent, but I definitely need your feedback to make it better.

Stats Breakdown

And, just for fun:

Notably New Projects

Each week I’m going to look over some interesting new projects that have just showed up on GitHub and explain what they’re about. If you have a project you think I should showcase, let me know and I’ll see about featuring it!

Wysihat

A minimalist’s approach to WYSIWYG/Rich Text Editor. Right now it’s very, very beta, but it has the support of 37Signals so I definitely hope it’s destined for greatness. Once some decent themes are created for it, I’d definitely consider integrating it in some of my sites. This project definitely is growing and needs help, so fork away.

Android

Google announced that their Android framework was going open source and was hosted on Git, so it was clearly only a matter of time before their code landed on GitHub too. They have a ton of projects in their codebase, but it doesn’t seem like all of them have pushed yet. Definitely looks promising though, and I really would like to see how their system works.

acts_as_passive_aggressive

Just in case you ever needed a way to vent on your users, this plugin provides the perfect opportunity. I love the project’s readme.

VoteReport

This is a new Rails site to track the election next week through Twitter. They’ve got quite a lot of documentation on their PBWiki, and I really hope that this site turns out to be a little more useful and fun than watching tweets fly by on Twitter’s election page. If you want to help them get the project up and running before the 4th, go for it!

javascript-xhtml-purifier

A new, robust JS script to sanitize HTML. I can guarantee that at some point most web developers will need to do this, so bookmark or clone away.

Next week I’d love to break down the stats a little more and figure out what commits were the most commented on, and maybe which projects had the most activity. Let me know what you’d like to see in the future!

Permalink · Rating: · Written on: 10-26-08 · 4 Comments »

Pumpkin Carving 2008

In 2006 I created a stormtrooper. Last year was HomestarRunner. This year however, I paid homage to the one and the only, Octocat:

This of course is the logo of one of my favorite sites, GitHub. We’re having our Halloween party this weekend so I made this guy a little early this year.

If you’re curious, you can see the creation process on my new Flickr account (their upload and photo managing interface is kickass!). If you’d like the stencil I used, just leave a comment or email me. Happy Halloween!

Fork it.

Permalink · Rating: · Written on: 10-20-08 · 1 Comment »

Where do you get Ruby news from?

I’m wondering where other fellow Ruby and Rails hackers get their Ruby-related news fix from. For some reason I just feel continually disconnected from the community at large and I just want to make sure I’m taking advantage of the resources out there. So here’s my news sources:

  1. Ruby.Reddit (http://reddit.com/r/ruby)

    This seems to be one of the most active sources, and usually the commentors are fantastic. It’s community-driven news at its best, but sometimes it’s a little slow compared to the other subreddits. What I like most about it is that the community is relatively small, so if you post a story it usually sticks on the page for a few days.

  2. RubyFlow (http://rubyflow.com)

    I just got into RubyFlow recently, and it seems more like the community well than anything. You can throw a coin in and wish for some visitors to your blog, but you’re usually lost in the mix. It’s a very interesting concept though, and it’s definitely fun to see big names in the Ruby community on the list.

  3. Ruby.Alltop (http://ruby.alltop.com)

    Alltop is awesome for getting an overall sense of where the community is right now. It’s Guy Kawasaki’s ‘magazine rack’ of latest Ruby stories…essentially a RSS aggregator. I’ve discovered quite a few blogs I didn’t know about and now keep track of through it. One of my goals with this blog is to get on there someday! :)

I suppose my secondary news sources would be Freenode’s various Ruby channels (mostly #rubyonrails) and the Rails mailing list, but I don’t check those as often. I’ve also heard about a secret channel, but who knows if I’ll ever get in there. Those also don’t have a handy RSS feed, so I tend not to check them as often. So, where do you get news about the Ruby community from?

Permalink · Rating: · Written on: 10-19-08 · 7 Comments »

Calculating Age in Rails

You’d think that this would be easy, but for some reason it wasn’t, at least for me. Let’s say you keep track of a User’s birthday with a date field. Great! Let’s show the user’s age.

def age
  Date.today.year - birthday.year
end

Done! Right? WRONG. Worked fine for some users, until one of my coworkers asked me…hey, you’re not 21 yet…how’d you magically gain a year on your profile? Crap. Obviously this will work for everyone’s whose birthday is BEFORE Date.today, but not after.

So, we need a more exact method of calculating the age:

def age
  ((Date.today - birthday) / 365).floor
end

So what this method does instead is use the Rational value given by subtracting two Dates, and divides it by the number of days in a year. Since that number is still a Rational, calling floor on it will round it down to the nearest Fixnum, giving us a (slightly more) precise account of this user’s age. EDIT: But this is still inaccurate!

Yeah, I thought it was easy too. Perhaps this shows that I need to test my app a little more thoroughly! It also would be nice to save the age in an instance level variable, but right now I don’t use the age more than once on a page so it doesn’t matter.

EDIT: It looks like my method is still not sufficient for leap years! The comments have posted MANY great solutions. My method is fine for a general estimation, but the comments have many solutions for that deal with greater accuracy. I’m honestly not sure which is best, so choose carefully when you’re developing your app.

Permalink · Rating: · Written on: 10-13-08 · 14 Comments »