Last active
August 29, 2015 14:07
-
-
Save baldur/e3f5708832b517c7c0dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<div id="stats"></div> | |
<style> | |
.h2 { | |
width: 100%; | |
display: block; | |
} | |
.box { | |
display: inline-block; | |
border: 1px solid black; | |
width: 400px; | |
height: 150px; | |
padding: 10px; | |
} | |
</style> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<!-- the JS to the do the listing --> | |
<script> | |
function parseAndDisplay(payload) { | |
var $el = $('<h2>'); | |
$el.text(payload['data'][0]['full_name'].replace(/\/.*/,'')); | |
$('#stats').append($el); | |
payload['data'].forEach(function(data) { | |
if ((parseInt(data['watchers']) || parseInt(data['stargazers_count']) || parseInt(data['forks'])) && !data['fork'] ) { | |
var $wrapper = $('<div class="box">'); | |
$wrapper.append($("<h3>").html(data['full_name'])); | |
$wrapper.append($("<p>").html("watchers: " + data['watchers'] + " stars: " + data['stargazers_count'] + " forks: " + data['forks'])); | |
$('#stats').append($wrapper); | |
} | |
}); | |
} | |
</script> | |
<script src="https://api.github.com/orgs/tangram-map/repos?callback=parseAndDisplay"></script> | |
<script src="https://api.github.com/orgs/mapzen/repos?callback=parseAndDisplay"></script> | |
<script src="https://api.github.com/orgs/pelias/repos?callback=parseAndDisplay"></script> | |
<script src="https://api.github.com/orgs/geopipes/repos?callback=parseAndDisplay"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment