Skip to content

Instantly share code, notes, and snippets.

@seanparsons
Created February 20, 2011 23:51
Show Gist options
  • Save seanparsons/836435 to your computer and use it in GitHub Desktop.
Save seanparsons/836435 to your computer and use it in GitHub Desktop.
Example visualizer code for Akka commits.
import scala.io.Source
import scala.xml._
import scala.collection.mutable._
val source = Source.fromURL("""http://query.yahooapis.com/v1/public/yql?q=select%20commit.author.name,%20commit.id%20from%20github.repo.commits%20where%20id='jboner'%20and%20repo='akka'&diagnostics=true&env=store://datatables.org/alltableswithkeys""")
val sourceXML = XML.loadString(source.mkString)
val commits = sourceXML \ "results" \ "commits" \ "commit"
val authorsToCommits: MultiMap[String, String] = commits.foldLeft(new HashMap[String, Set[String]] with MultiMap[String, String]){(multiMap,commit) =>
multiMap.addBinding((commit \ "author" \ "name").text, (commit \ "id").text)
}
source.close()
result.set(authorsToCommits.mapValues{set => set.size})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment