Created
July 30, 2013 11:46
-
-
Save kalisjoshua/6112267 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
/*jshint laxcomma:true*/ | |
var APICraft = (function APICraft_API_closure (baseURL) { | |
return function (endpoint) { | |
return baseURL + endpoint; | |
}; | |
}('http://api.api-craft.org/conferences/detroit2013/')); | |
$.fn.ready(function ($) { | |
var DAYNAMES | |
, DAYNAMESLONG | |
, TODAYSDAYNAME | |
, TODAYSDAYNAMELONG; | |
DAYNAMES = 'Sun Mon Tue Wed Thu Fri Sat'.split(' '); | |
DAYNAMESLONG = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' '); | |
TODAYSDAYNAME = (/\w+/) | |
.exec(new Date())[0]; | |
TODAYSDAYNAMELONG = DAYNAMESLONG[DAYNAMES.indexOf(TODAYSDAYNAME)]; | |
$.get(APICraft('agenda'), function (res) { | |
var todays_events; | |
todays_events = res.agenda | |
.filter(function (item) { | |
return ~item.end.indexOf(TODAYSDAYNAMELONG); | |
}); | |
$('section') | |
.html($('<pre>').text(JSON.stringify(todays_events))); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment