This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run timer | |
| logs = asyncio.run(pom.work()) | |
| # format logs | |
| logs = [ | |
| ( | |
| task, | |
| start.strftime("%m/%d/%Y %H:%M:%S"), | |
| finish.strftime("%m/%d/%Y %H:%M:%S"), | |
| (finish - start).total_seconds()/3600 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load the audio file | |
| with importlib.resources.path(audio, "alarm.wav") as alarmPath: | |
| wave_obj = sa.WaveObject.from_wave_file(str(alarmPath)) | |
| # code | |
| # code | |
| # When the work is done play the bell | |
| if not task.finished and task.endTime - task.startTime >= task.workInterval: | |
| wave_obj.play() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Concurrently listen and display. Return user data when finished. | |
| async def work(self): | |
| await asyncio.gather(self.listen(), self.display()) | |
| return [(task.task, task.startTime, task.endTime) for task in self.tasks] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async def listen(self): | |
| while True: | |
| content = await ainput("") | |
| if content == '': | |
| if self.tasks[-1].task != 'break': | |
| self.tasks.append(PomodoroTask('break', self.breakInterval)) | |
| else: | |
| self.tasks.append(PomodoroTask(self.task, self.workInterval)) | |
| elif content == 'q': | |
| self.finished = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pom = Pomodoro( | |
| task="open source", | |
| workInterval=timedelta(minutes=30), | |
| breakInterval = timedelta(seconds=5), | |
| goal = timedelta(hours=2)) | |
| logs = asyncio.run(pom.work()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Open Source": [ | |
| { | |
| "activity": "Open Source" | |
| } | |
| ], | |
| "morning1": [ | |
| { | |
| "activity": "wake up", | |
| "m": 10, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Open-EdTech/mostly-adequate-guide/ch01.md": { | |
| "treePath": [0], | |
| "ghUrl": "https://github.com/Open-EdTech/mostly-adequate-guide/blob/master/ch01.md", | |
| }, | |
| "Open-EdTech/mostly-adequate-guide/ch02.md": { | |
| "treePath": [1], | |
| "ghUrl": "https://github.com/Open-EdTech/mostly-adequate-guide/blob/master/ch02.md", | |
| }, | |
| //... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bookTree from '../bookTree.json' | |
| export const getStaticProps = async ({ params }) => { | |
| //traverse the tree to make the metaObject | |
| const metaObject = getAllRoutesInfo(bookTree); | |
| //Turn the id into a string that is a key from allRoutesInfo | |
| const stringRoute = (params!.id).join("/"); | |
| //Grab what you need | |
| const {ghUrl, treePath} = metaObject[stringRoute] | |
| //Pass it to the child component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Node from "./Node"; | |
| const RenderNode = ({node, pagePath}) => { | |
| return ( | |
| <div> | |
| <Node node={node} pagePath={pagePath}/> | |
| {node.children && node.open && ( | |
| <div | |
| style={{ | |
| margin: "2px 0px 2px 12px", |