Into Week 5
It’s already week 5 and we are succesfully hacking the internets(somewhat). Our weekend assignment had us writing code that makes requests to github.com’s api and return statistics about a repositories contributors.
What you get back when you make such a request is pretty much the matrix (it’s actually a hash of json stuff). The next step was to write some code that iterated over that hash and build up a hash on my side the way I wanted. In this case the contributor, the number of lines they added, the number deleted and the number of commits made. That step was probably the hardest as I’ve not done much with hashes just yet. We also needed to be able to sort it by statistic which was not a hard thing to code once the hash was in place. For a final touch I installed a gem called “awesome_print” that makes things look nice and pretty in the terminal. It also comes with some cool looking debugging features that I have not yet messed with. Below is the result of a query on the sinatra repo. Pressing the letter that the user is prompted will re-sort the stats from least to most by that stat(getting the data and building the hash takes a second, but once its in the hash the resort is very very fast owing to the nature of hash keys in ruby).
Tonights assignment is again dealing with github, but this time we are using a server running sinatra that is using an erb. The html is going to display buttons that allow us to look up and close or open github issues….time to get hacking.