Skip to content

Instantly share code, notes, and snippets.

@satour
Created September 8, 2016 10:22
Show Gist options
  • Save satour/9ed750ff4b46f3cbf4418ac0194ce0ee to your computer and use it in GitHub Desktop.
Save satour/9ed750ff4b46f3cbf4418ac0194ce0ee to your computer and use it in GitHub Desktop.
<!-- すげー雑なのでそのうち書き直すかも -->
<HTML lang="ja">
<header>
<meta charset="utf-8">
<script src="https://cdn.mlkcca.com/v0.6.0/milkcocoa.js"></script>
<script>
var milkcocoa = new MilkCocoa('your-app-id.mlkcca.com');
var dataset = milkcocoa.dataStore('your-datastore-name').history();
dataset.sort('desc');
dataset.size(280);
var onDataCount = 0;
var uuids = [];
dataset.on('data', function(data) {
document.write( "<body>" );
document.write( "<div class='container'>" );
document.write( "<h1>Milkcocoa データみえる君</h1>" );
document.write( "<table>" );
document.write( "<thead>" );
document.write( "<tr>" );
document.write( "<th>count</th>" );
document.write( "<th>date</th>" );
document.write( "<th>time</th>" );
document.write( "<th>uuid-8</th>" );
document.write( "<th>faceId</th>" );
document.write( "<th>gender</th>" );
document.write( "<th>age</th>" );
document.write( "</tr>" );
document.write( "</thead>" );
for (var i=0 ; i<= 279 ; i++){
document.write( "<tbody>" );
document.write( "<tr>" );
document.write( "<td>", ++onDataCount , "</td>" );
document.write( "<td>", data[i].value.array[0].Timestamp.slice(5, 10) , "</td>" );
document.write( "<td>", data[i].value.array[0].Timestamp.slice(11, 16) , "</td>" );
document.write( "<td>", data[i].value.array[0].UUId.slice(0, 7) , "</td>" );
document.write( "<td>", data[i].value.array[0].faceId , "</td>" );
document.write( "<td>", data[i].value.array[0].faceAttributes.gender , "</td>" );
document.write( "<td>", data[i].value.array[0].faceAttributes.age , "</td>" );
document.write( "</tr>" );
document.write( "</tbody>" );
}
document.write( "</table>" );
document.write( "</div>" );
document.write( "</body>" );
document.write( '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css" />')
});
dataset.on('error', function(err) { document.write(err) });
dataset.run();
</script>
</header>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment