Skip to content
This repository has been archived by the owner on Aug 6, 2018. It is now read-only.
/ yearglass Public archive

Time (year progress) is passing quickly, but we are not aware of it.

License

Notifications You must be signed in to change notification settings

ApolloZhu/yearglass

Repository files navigation

Time goes by, or maybe it stays?

Swift 3 & 4 Swift Package Manager MIT License

A command line util to visualize percentage passed of this year, inspired by year_progress on twitter. 中文版文档请点击这里:年轮项目

Install/Update

Open Terminal (or equivalent), and install/update yearglass by:

eval "$(curl -sL https://raw.githubusercontent.com/ApolloZhu/yearglass/master/install)"

First published when 17% of 2017 has passed. <script> /* The following code is used to generate dynamic yearglass progress bar for the website version of this doc -- https://apollozhu.github.io/yearglass/ */ const today = new Date(); const year = today.getFullYear(); const thisYear = new Date(year, 0, 1); const nextYear = new Date(year + 1, 0, 1); const oneDay = today.getMilliseconds(); const passed = Math.floor((today - thisYear) / oneDay); const total = Math.floor((nextYear - thisYear) / oneDay); const percentage = passed / total; const space = 24; function repeat(s, n) { return new Array(Math.floor(n + 1)).join(s); } document.getElementById("yearglass-web").innerHTML = "Year Progress: " + Math.floor(percentage * 100) + "% passed
[" + repeat(">", space * percentage) + repeat("-", space * (1 - percentage)) + "]"; </script>