Skip to content

Instantly share code, notes, and snippets.

@en45masao
Created February 19, 2012 12:06
Show Gist options
  • Save en45masao/1863463 to your computer and use it in GitHub Desktop.
Save en45masao/1863463 to your computer and use it in GitHub Desktop.
The Longest Day in iKnow!
javascript:(function(){var uid=''||window.prompt('iKnow! ID:','en45');$.get('http://iknow.jp/api/users/'+uid+'/study_results.json?since=2009-11-04',function(data){var max=0;var date='';$.each(data.daily,function(i,item){if(max<item.daily.items.seconds){max=item.daily.items.seconds;date=item.date;}});var s=max%(60);var m=Math.floor(max/60)%(60);var h=Math.floor(max/3600);alert('The Longest Day: '+h+'h '+m+'m '+s+'s '+date);});})()
var uid='' || window.prompt('iKnow! ID:', 'en45');
$.get('http://iknow.jp/api/users/' + uid + '/study_results.json?since=2009-11-04', function(data) {
var max = 0;
var date = '';
$.each(data.daily, function(i, item) {
if (max < item.daily.items.seconds) {
max = item.daily.items.seconds;
date = item.date;
}
});
var s = max % 60;
var m = Math.floor(max / 60) % 60;
var h = Math.floor(max / 3600);
alert('The Longest Day: ' + h + 'h ' + m + 'm ' + s + 's ' + date);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment