Get your public activity feed in a human readble format.
bower install
What's bower?
If you want to take advantage of octicons make sure they are linked in the page
<link rel="stylesheet" href="bower_components/octicons/octicons/octicons.css" />
make sure that jquery, moment.js and github-activity-feed are loaded.
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/moment/min/moment.min.js"></script>
<script src="bower_components/github-activity-feed/src/github-activity-feed.js"></script>
then initialize...
var gh = new GithubActivityFeed("andrewhood125");
Now you are ready to get your hooman readble activity!
GithubActivityFeed has two public api points to make things as easy as
possible. gh.events
and gh.user
are both jQuery
$.Deferred() objects.
####gh.events
example
gh.events.done(function(events) {
// The GitHub headers and some other
// interesting things live in here.
console.log(events.meta);
// Array of your events
console.log(events.data);
});
{
icon: '<span class="mega-octicon octicon-git-commit"></span>',
text: '<a href="https://github.com/andrewhood125">andrewhood125</a> created tag <a href="https://github.com/andrewhood125/github-activity-feed/tree/0.1.6">0.1.6</a> at <a href="https://github.com/andrewhood125/github-activity-feed">andrewhood125/github-activity-feed</a>',
timeago: '<span class="timeago"> about 22 hours ago</span>',
details: [
'Not all event types have details.',
'If not then -- details: undefined'
]
}
####gh.user
example
gh.user.done(function(user) {
// Same as events above
console.log(events.meta);
// Lots of stuff about you!
// Open up index.html and you'll see
// the entire list
console.log(events.data);
});
If for some reason user or events can't resolve correctly then they will fail. In that case you can access a message like so.
gh.user.fail(function(user) {
alert(user.data.message);
});
gh.events.fail(function(events) {
alert(events.data.message);
});
npm is used for the dev dependencies. I'm using mocha for testing with blanket for coverage, and grunt to run it all.
npm install
npm install -g grunt-cli
grunt