Skip to content

Instantly share code, notes, and snippets.

@kalisjoshua
Created July 30, 2013 11:46
Show Gist options
  • Save kalisjoshua/6112267 to your computer and use it in GitHub Desktop.
Save kalisjoshua/6112267 to your computer and use it in GitHub Desktop.
/*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