andrewhood125 / github-activity-feed

Get your GitHub public activity feed in a human readable format

Home Page:https://andrew-hood.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

github-activity-feed

Build Status Gitter Code Climate

Get your public activity feed in a human readble format.

Useage

Bower

bower install What's bower?


Page setup

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);

    });

A single events structure

{
	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);
});

Handling Failure

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);
});

Tests and Coverage

npm

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

About

Get your GitHub public activity feed in a human readable format

https://andrew-hood.com

License:MIT License


Languages

Language:JavaScript 96.1%Language:HTML 3.9%