Skip to content

Instantly share code, notes, and snippets.

@benwong
Created January 23, 2017 22:47
Show Gist options
  • Save benwong/5f3d2a45226960af3609ee338cf6ec7e to your computer and use it in GitHub Desktop.
Save benwong/5f3d2a45226960af3609ee338cf6ec7e to your computer and use it in GitHub Desktop.
/**
script to extract calendar data from basketball fixture
*/
(function(){
function writeEvent(date, time, venue, opponent) {
let data = ['Basketball',date.replace(' (Sun)', ''), time, venue.trim(), opponent];
console.log(data.join(','));
}
let headings = ['Subject', 'Start Date', 'Start Time', 'Description', 'Location'];
console.log(headings.join(','));
$('tr:gt(1)').each(function () {
let $this = $(this);
let date = $this.find('td:eq(1)').text();
let time = $this.find('td:eq(2)').text();
let venue = $this.find('td:eq(3)').text();
let opponent = $this.find('td:eq(6)').text();
writeEvent(date, time, venue, opponent);
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment