Commit d916f887 authored by Savvas Alexandrou's avatar Savvas Alexandrou

update goto-antamoamta

parent 88b7723c
......@@ -6,4 +6,6 @@ node_modules
package-lock.json
public
Gemfile.lock
\ No newline at end of file
Gemfile.lock
*~
\ No newline at end of file
......@@ -13,16 +13,14 @@
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Your awesome title
email: your-email@example.com
description: >- # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
title: goto antamomata
email: goto@antamomata.org
description: Goto Antamomata # this means to ignore newlines until "baseurl:"
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: jekyllrb
github_username: jekyll
url: "goto.antamomata.org" # the base hostname & protocol for your site, e.g. http://example.com
# twitter_username: jekyllrb
# github_username: jekyll
# Build settings
markdown: kramdown
......@@ -47,5 +45,6 @@ exclude:
- vendor/cache/
- vendor/gems/
- vendor/ruby/
- publish.sh
stimulus_output_dir: "/public/"
---
layout: post
title: "Welcome to Jekyll!"
date: 2018-03-11 14:17:43 +0200
categories: jekyll update
---
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
[jekyll-docs]: https://jekyllrb.com/docs/home
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-talk]: https://talk.jekyllrb.com/
---
layout: page
title: About
permalink: /about/
---
This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)
You can find the source code for Minima at GitHub:
[jekyll][jekyll-organization] /
[minima](https://github.com/jekyll/minima)
You can find the source code for Jekyll at GitHub:
[jekyll][jekyll-organization] /
[jekyll](https://github.com/jekyll/jekyll)
[jekyll-organization]: https://github.com/jekyll
......@@ -2,10 +2,9 @@
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
layout: default
---
<div data-controller="hello">
<input data-target="hello.name" type="text">
<button data-action="click->hello#greet">Greet</button>
<div data-controller="time">
<div data-target="time.current"></div>
<h1><div data-target="time.what"></div><h1>
</div>
./node_modules/webpack/bin/webpack.js --config webpack.config.js --progress --profile --bail
JEKYLL_ENV=production jekyll clean
JEKYLL_ENV=production jekyll build
pass -c vps241324.ovh.net/jekyll & rsync -avr --rsh='ssh -p1990' --delete-after --delete-excluded _site/ jekyll@vps241324.ovh.net:~/public_html/goto_antamomata_org/
......@@ -4,7 +4,8 @@ export default class extends Controller {
static targets = [ "name" ]
greet() {
console.log(`Hello hello, ${this.name}!`)
let time = new Date()
console.log(`Hello hello, ${this.name}! ${time}`)
}
get name() {
......
import { Controller } from "stimulus"
export default class extends Controller {
static targets = [ "current", "what" ]
connect() {
this.greet()
this.startRefreshing()
}
greet() {
let currentTime = this.currentTime
let busesAround = this.busesAround(currentTime)
let lastBusLeftAt = busesAround[0]
let nextBusLeavingAt = busesAround[1]
let durationWhenTheLastBusLeft = this.getInMinutes(currentTime - lastBusLeftAt)
if (3 <= durationWhenTheLastBusLeft && durationWhenTheLastBusLeft <= 8) {
let minutesToBeThere = 10 - durationWhenTheLastBusLeft
this.whatTarget.textContent = `Hurry up. Leave now. You should be at Theological School in less than ${minutesToBeThere} minutes.`
} else if (durationWhenTheLastBusLeft < 3) {
let durationToLeaveFromHouse = 3 - durationWhenTheLastBusLeft
this.whatTarget.textContent = `Leave for Theological School bus stop in ${durationToLeaveFromHouse} minutes`
} else {
let durationToLeaveFromHouse = this.getInMinutes(nextBusLeavingAt - currentTime) + 3
this.whatTarget.textContent = `Leave for Theological School bus stop in ${durationToLeaveFromHouse} minutes`
}
// this.whatTarget.textContent = `Eftasee`
// cases
// symferei na paw me ta podia (ignore it currently)
// mporw na kamw kati kai na paw me to leoforeio
// print X time in order to leave from home gia na ftaseis to bus
// ean
// (current time - time that last bus left) in minutes < (to xrono pou thelei na ftasei sti theologiki - to xrono pou thelw na paw sti theologiki) min ||
}
getInMinutes(diffInMilliseconds) {
let result = Math.round(diffInMilliseconds / 60000)
return result
}
startRefreshing() {
setInterval(() => {
this.greet()
}, 10000)
}
getEstimatedMinutes(route) {
let estimatedMinutes = {
fromHouseToTheologicalSchoolBusStationOnFoot: 5,
fromRigenisBusStationToSolomouSquareBusStationOnFoot: 5,
fromTheologicalSchoolBusStationToRigenisBusStationByBus: 8,
lambdaEnaFromTheBeginningToTheologicalSchoolBusStation: 8,
fromHouseToSolomouOnFoot: 15
}
let result = estimatedTimes[route]
return result
}
busesAround(currentTime) {
let hours = currentTime.getHours()
let minutes = currentTime.getMinutes()
let year = currentTime.getYear()
let tempTime = new Date(currentTime)
tempTime.setSeconds(0)
// TODO special case that we should handle differently
let prevTime = 0
for(let tm of this.timetable) {
tempTime.setHours(tm[0])
tempTime.setMinutes(tm[1])
if( tempTime > currentTime) {
return [prevTime, tempTime]
}
prevTime = new Date(tempTime)
}
}
get nextBus() {
let time = this.currentTime
let hours = time.getHours()
let minutes = time.getMinutes()
let year = time.getYear()
let tempTime = new Date(time)
tempTime.setSeconds(0)
for(let tm of this.timetable) {
tempTime.setHours(tm[0])
tempTime.setMinutes(tm[1])
if( tempTime > time) {
// console.log(tempTime)
return tempTime
}
}
}
get currentTime() {
return new Date()
}
get timetable() {
return [
[7, 30], [7, 50], [8, 10], [8, 30], [8, 50],
[9, 10], [9, 50], [10, 10], [10, 30], [10, 50],
[11, 10], [11, 30], [12, 30], [12, 50], [13, 10],
[13, 30], [13, 50], [14, 10], [14, 30], [14, 50],
[15, 10], [15, 30], [15, 50], [16, 10], [16, 30],
[16, 50], [17, 10], [17, 30], [18, 10], [18, 30],
[18, 50], [19, 10], [19, 30], [19, 50], [20, 50],
[21, 10], [21, 30], [21, 50], [22, 10], [22, 30],
[22, 50], [23, 10], [23, 30], [23, 50]
]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment