interlude/schedule.js

145 lines
3.6 KiB
JavaScript
Raw Normal View History

2014-05-13 07:27:47 +03:00
function Schedule() {
var events = [];
this.addEvent = function(event) {
events.push(event);
events = _.sortBy(events, function(event) {
return event.startTime.unix()
});
}
this.upcomingEvents = function() {
return _.select(events, function(event) {
return event.startTime.isAfter(moment());
});
}
this.nextEvent = function() {
return _.first(this.upcomingEvents());
}
2014-06-21 05:08:15 +03:00
this.currentEvent = function() {
2014-06-21 10:55:38 +03:00
var latestEvent = _.last(this.pastEvents());
2014-06-21 05:08:15 +03:00
var nextEvent = this.nextEvent();
2014-08-20 14:36:12 +03:00
if (typeof nextEvent != 'undefined' && moment(nextEvent.startTime).subtract('minutes', 10).isAfter(moment())) {
2014-06-21 10:55:38 +03:00
return latestEvent;
} else {
return undefined;
}
2014-06-21 05:08:15 +03:00
}
2014-05-13 15:43:58 +03:00
this.futureEvents = function() {
return this.upcomingEvents().splice(1);
}
this.pastEvents = function() {
return _.select(events, function(event) {
return event.startTime.isBefore(moment());
});
}
this.allEvents = function() {
2014-05-13 07:27:47 +03:00
return events;
}
this.addDelay = function(time) {
_.each(this.upcomingEvents(), function(event, index, agenda) {
event.startTime.add(time);
});
}
}
var schedule = new Schedule();
2014-06-21 04:28:41 +03:00
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Regex 101',
startTime: moment({hour: 10, minute: 00}),
speakers: [
{
name: 'Bradley Andersen (elohmrow)',
description: 'Je n\'avais pas besoin de cette hypothese-la'
}
]
2014-06-21 04:28:41 +03:00
});
2014-05-13 07:27:47 +03:00
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'HTTP Clients and Perl',
startTime: moment({hour: 11}),
speakers: [
{
name: 'Tom Hukins',
description: ''
}
]
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Dancer and DBIx::Class',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 11, minute: 30}),
2014-07-10 13:25:55 +03:00
speakers: [
{
2014-08-23 09:48:32 +03:00
name: 'Stefan Hornburg (racke)',
description: 'Open source consultant since 1998, with the focus on E-Commerce, Perl and Debian. Started using Dancer in 2011 and is now part of the Dancer development team.'
2014-07-10 13:25:55 +03:00
}
]
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-22 12:50:59 +03:00
title: 'Lunch',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 12, minute: 20})
2014-05-13 07:27:47 +03:00
});
2014-06-21 12:13:55 +03:00
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Reading the layercake, an introduction to PerlIO',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 13, minute: 20}),
2014-07-10 13:25:55 +03:00
speakers: [
{
2014-08-23 09:48:32 +03:00
name: 'Leon Timmermans (leont)',
description: 'He\'s a Dutch perl hacker, mainly known for File::Map, Module::Build::Tiny, libperl++ and threads::lite, as well as some contributions to core.'
2014-07-10 13:25:55 +03:00
}
]
2014-06-21 12:13:55 +03:00
});
2014-05-13 07:27:47 +03:00
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Devops Logique',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 13, minute: 50}),
2014-07-10 13:25:55 +03:00
speakers: [
{
2014-08-23 09:48:32 +03:00
name: 'Matt S Trout (mst)',
description: ''
2014-07-10 13:25:55 +03:00
}
]
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Functional Pe(a)rls: Huey\'s Zipper',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 14, minute: 50}),
2014-07-10 13:25:55 +03:00
speakers: [
{
2014-08-23 09:48:32 +03:00
name: 'osfameron',
description: 'mySociety, DoES Liverpool (coworking/hackspace), co-author of Designing the Internet of Things'
2014-07-10 13:25:55 +03:00
}
]
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Coffee Break',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 15, minute: 40})
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-22 12:50:59 +03:00
title: 'Lightning Talks',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 16, minute: 10}),
2014-05-13 07:27:47 +03:00
});
schedule.addEvent({
2014-08-23 09:48:32 +03:00
title: 'Day 2 Keynote - State of the Velociraptor',
2014-08-20 14:16:53 +03:00
startTime: moment({hour: 17, minute: 10}),
2014-07-10 13:25:55 +03:00
speakers: [
{
2014-08-23 09:48:32 +03:00
name: 'Matt S Trout (mst)',
description: ''
2014-07-10 13:25:55 +03:00
}
]
2014-05-13 07:27:47 +03:00
});