Commits and comments with emotions are good for your health
Have a look at http://zunda.github.io/emoticommits/. The map shows commits and comments of GitHub users, along with their avatars, or, better than those, emoticons
- 2015-01-31 As zunda can not spare time to follow the change in the GitHub API, he decided to postpone update of the commits for a while.
The idea of showing acitivities on a world map heavily comes from the late Hello world! - greetings to the planet by which showed greetings from Twitter users real time. The big difference seems to be that the GitHub users do not care much if it is day
Extracting commits and comments with locations
A server runs record_activity.rb as an hourly cron job that parses hourly JSON file from GitHub Archive. The process extracts events from the JSON file, queries GitHub API when needed, and stores them into an SQLite3 database. It seems that about half of events can be queired within the limited time - meaning that not all activities are shown on the map. Queries are shuffled before executed so events are distributed evenly in the time period. Afterwards, it looks up GitHub users' locations from GeoCoding results stored in another SQLite3 database, and queries the Google Geocoding API up to 100 locaitons, so that queries will be within the rate limit of 2,500/day.
Creating JSON files for markers on the map
As the map shows evetns of either 24 hours ago or 7 days ago, JSON files of markers for 23 hours ago and 7 days minus 1 hour ago are created, by create_markers.rb as another cron job, from the local databases every hour and automatically committed and pushed to the GitHub pages.
Displaying night on the map
google.maps.Polygon converts the great circles onto the Mercator map with the
geodesic: true option.
When you fork
User-Agent string defined as
AGENT constant in githubapi.rb or geocoding.rb. To access GitHub API frequently, record_activity.rb reads your username and password from ~/.githubarchiverc, which should look something like below:
@github_auth = ['username', 'password']
To automatically create and update JSON files to be posted to the GitHub pages, a working copy of the
gh-pages branch should be checked out and the path to that copy should be set to the command line argument for create_markers.rb in crontab. While normal operations, progress of the processes are logged with
Syslog::Logger#info presumably to /var/log/messages. A passphraseless SSH key maybe needed to automtically push to GitHub pages.
git-new-workdir may be used to check out
gh-pages branch as well as trunk to improve code:
$ cd to-working-copy $ sh /usr/share/doc/git-core/contrib/workdir/git-new-workdir . ../emoticommits-gh-pages $ cd ../emoticommits-gh-pages $ git checkout gh-pages
Please see the LICENSE file.