Last active
August 29, 2015 14:16
-
-
Save rolandshoemaker/87961f144512a07e32e7 to your computer and use it in GitHub Desktop.
quick github activity
This file contains 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
<script> | |
$.get("https://api.github.com/users/rolandshoemaker/events?per_page=5", function(data) { | |
var output = []; | |
for (var event in data) { | |
if (data[event].type == "PushEvent") { | |
var dt = new Date(Date.parse(data[event].created_at)); | |
var ds = dt.getDate()+"/"+(dt.getMonth()+1)+"/"+dt.getFullYear()+" "+(dt.getUTCHours()+1)+":"+dt.getUTCMinutes()+" UTC"; | |
output.push(["<a href=\"https://github.com/"+data[event].repo.name+"\">"+data[event].repo.name+"</a>", data[event].payload.commits[data[event].payload.size-1].message, ds]); | |
} | |
} | |
$(".github-activity").append(buildTable(output)); | |
}); | |
function buildTable(stuff) { | |
var html = "<table class=\"github\"><thead><tr><th>repository</th><th>message</th><th>when</th></tr></thead><tbody>"; | |
for (var row in stuff) { | |
html += "<tr>"; | |
for (var cell in stuff[row]) { | |
html += "<td>"+stuff[row][cell]+"</td>"; | |
} | |
html += "</tr>"; | |
} | |
html += "</tbody></table>"; | |
return html; | |
} | |
</script> | |
<style> | |
table.github { | |
background-color: #eee; | |
width: 95%; | |
margin: 0 auto; | |
font-family: Consolas,Monaco,'Andale Mono',monospace; | |
font-size: 1rem; | |
border: none; | |
} | |
table.github td { | |
max-width: 500px; | |
padding: 2px; | |
line-height: normal; | |
} | |
table.github td a { | |
color: #CF7979; | |
} | |
table.github td a:visted { | |
color: #B06161; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment