Commits and comments with emotions are good for your health ๐Ÿ˜„
Ruby
Fetching latest commitโ€ฆ
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
emoji-cheat-sheet.com @ 2ad9723
etc
lib
scratch
test
.gitmodules
LICENSE.md
README.md
screenshot-s.png
screenshot.png
update-emojis.rb

README.md

Emoticommits

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 :octocat: users, along with their avatars, or, better than those, emoticons ๐Ÿ˜ƒ from commit messages or comments. Please note that not all activities are shown. Click the icons to have a look at the activities on GitHub.

  • 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.

Screen shot

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 โ˜€๏ธ or night ๐ŸŒ”

Implementation

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

The map loads a JSON file of markers thorugh markers.js, which show commits or comments along with users' location, every hour on 50 minutes.

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

The map shows day and night areas through sun.js. The JavaScript calculates direction (latitude and longitude) of the Sun on the earth and creates paths, as great cicles on the Earth surface, for the night shade divided into four areas. A google.maps.Polygon converts the great circles onto the Mercator map with the geodesic: true option.

Fork

When you fork๐Ÿด the repository, please kindly change the API key for Google Map in map.html to yours. When you heavily change behavior accessing the GitHub or Google APIs, we would like to ask you to change the 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.

Alternatively, 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

License

Please see the LICENSE file.