Skip to content

Instantly share code, notes, and snippets.

@ArnaudLigny
Last active December 10, 2015 23:49
Show Gist options
  • Save ArnaudLigny/4512483 to your computer and use it in GitHub Desktop.
Save ArnaudLigny/4512483 to your computer and use it in GitHub Desktop.
Display Github repo list with javscript in HTML page.
<div class="github-repos span-9 last">
<h4>My Github Projects</h4>
<ul>
<li>Loading...</li>
</ul>
</div>
<div class="github-org-repos span-9 last">
<h4>Baobaz Github Projects</h4>
<ul>
<li>Loading...</li>
</ul>
</div>
<script type="text/javascript">
(function($) {
$(function() {
$.getJSON("https://api.github.com/users/narno/repos?callback=?", function(response) {
$("div.github-repos ul li").remove();
$.each(response.data, function(idx, repo) {
if(!repo.fork) {
$("div.github-repos ul").append(
$("<li>").append(
$("<a>")
.html(repo["name"])
.attr("href", repo["html_url"])
)
);
}
});
});
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment