Skip to content

Instantly share code, notes, and snippets.

@reline
Last active May 30, 2016 00:38
Show Gist options
  • Save reline/bef2c9d50833ad16d4de to your computer and use it in GitHub Desktop.
Save reline/bef2c9d50833ad16d4de to your computer and use it in GitHub Desktop.
function githubFeed($user) { // string param for GitHub username
$.ajax({
type: "GET",
url: "http://cors.io/?u=https://github.com/" + $user + ".atom",
cache: false,
dataType: 'xml',
success: function(result) {
console.log($user + ".atom loaded");
var atom = $("<span />", { html: result.firstChild }).text();
var githubActivity = $("#githubActivity");
githubActivity.html(atom);
var children = githubActivity.children();
githubActivity.html(children);
$('.github a').each(function () {
var href = $(this).attr('href');
if (href) {
href = "https://github.com" + href;
$(this).attr('href', href);
$(this).attr('target', "_blank");
}
});
$("#github-container").addClass("atom-container");
},
error: function (err) {
console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
},
async: true
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment