Skip to content

Instantly share code, notes, and snippets.

@jonathanpike
Last active June 13, 2018 16:28
Show Gist options
  • Save jonathanpike/60cc1235b451e7d38361cab8e31737b8 to your computer and use it in GitHub Desktop.
Save jonathanpike/60cc1235b451e7d38361cab8e31737b8 to your computer and use it in GitHub Desktop.
Go Train departures
.body {
background-color: #EFEFEF;
font-family: Arial, Verdana, Helvetica, Sans-Serif;
}
.flex-parent {
display: flex;
align-items: center;
justify-content: center;
}
.flex-child {
max-width: 50%;
background-color: #FFFFFF;
}
.go-text {
color: #387C2B;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Get GOing</title>
<link rel="stylesheet" href="{{ "/css/go.css" | prepend: site.baseurl }}">
<script async src="{{ "/assets/js/go.min.js" | prepend: site.baseurl }}"></script>
</head>
<body>
<div class="flex-parent">
<div class="flex-child">
<h1 class="go-text">The Next Train Leaves At</h1></br/>
<h1 class="go-text" id="fill"></h1><br/><br/>
<h1 class="go-text">Get <strong>GO</strong>ing!</h1>
</div>
</div>
</body>
</html>
var departures = [moment("8:50am", "h:mma"), moment("9:20am", "h:mma"), moment("9:50am", "h:mma"), moment("10:20am", "h:mma"), moment("10:50am", "h:mma"),moment("11:20am", "h:mma"), moment("11:50am", "h:mma"), moment("12:20pm", "h:mma"), moment("12:50pm", "h:mma"), moment("1:20pm", "h:mma"), moment("1:50pm", "h:mma"), moment("2:20pm", "h:mma"), moment("2:50pm", "h:mma"), moment("3:20pm", "h:mma"), moment("3:50pm", "h:mma"), moment("4:20pm", "h:mma"), moment("4:50pm", "h:mma"), moment("5:17pm", "h:mma"), moment("5:49pm", "h:mma"), moment("6:20pm", "h:mma"), moment("6:50pm", "h:mma"), moment("7:20pm", "h:mma"), moment("7:50pm", "h:mma"), moment("8:20pm", "h:mma"), moment("8:50pm", "h:mma"), moment("9:20pm", "h:mma"), moment("9:50pm", "h:mma")]
var nextDeparture
var currentTime = moment();
for(var i = 0; i < departures.length; i++)
if(departures[i] > currentTime) {
nextDeparture = departures[i];
break;
};
};
document.getElementById("fill").innerHTML = nextDeparture.format("h:mma");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment