Skip to content

Instantly share code, notes, and snippets.

@iesta
Created November 19, 2014 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iesta/6a752a5f471a01689b39 to your computer and use it in GitHub Desktop.
Save iesta/6a752a5f471a01689b39 to your computer and use it in GitHub Desktop.
Winner board pournosanimaux.fr
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment-with-locales.min.js"></script>
<h3>Last winners</h3>
<p>
<div id="luckyleaderboard"></div>
<script>
$.getJSON("https://www.luckycycle.com/operations/221f0b972b4ab7bcebc556ae777f8612/board.json?n=10", function (data) {
var items = [];
$.each(data, function (key, val) {
if (val.firstname) {
items.push('<li><span class="luckyname">' + val.firstname + " " + val.lastname.charAt(0) + '</span> has won <span class="luckyvalue"> ' + val.value + "&euro;" + '</span> <span class="luckydate">' + moment(val.date).fromNow() + '</span></li>');
}
});
$("<ul/>", {
"class": "luckywinners",
html: items.join("")
}).appendTo("#luckyleaderboard");
});
</script>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment