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
| let timeNow = new Date(); | |
| let currentHour = timeNow.getHours(); | |
| let count = 1; | |
| let idk = null | |
| function greet(){ | |
| if (count == 10){ | |
| clearInterval(idk); | |
| } | |
| if ((5 <= currentHour) && (currentHour <= 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
| const pluralize = function (value){ | |
| return Math.floor(value) > 1 ? 's' : ''; | |
| } | |
| function ago(date){ | |
| const now = Math.floor(Date.now()/1000) | |
| const time = new Date(date) | |
| if(isNaN(time.getTime())){ | |
| throw new Error(`Passed in date ${date} is not a valid date`) | |
| } |
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
| class TimeStampDB{ | |
| constructor (){ | |
| this.db = {} | |
| } | |
| set(key, timestamp, value){ | |
| this.db[key] = this.db[key] || {} | |
| this.db[key][timestamp] = value | |
| this.db[key]['timestamps'] = this.db[key]['timestamps'] || [] | |
| // find insert position for sorted set of timestamps array |
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 * as path from "path" | |
| import * as fs from "fs" | |
| // find all files that match the corresponding splitted directory component | |
| // find all files and folders that match the regular expression of the corresponding path | |
| // filter out all unmatched files/folders from the list based on splitted path | |
| function getIgnoredFiles(ignorePath: string) :string[]{ | |
| const allFiles = walk(process.cwd(), [], {}) | |
| const regex = buildRegex(ignorePath) |
OlderNewer