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
| function calendarWeek(d) { | |
| // Copy date so don't modify original | |
| d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); | |
| // Set to nearest Thursday: current date + 4 - current day number | |
| // Make Sunday's day number 7 | |
| d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7)); | |
| // Get first day of year | |
| var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1)); | |
| // Calculate full weeks to nearest Thursday | |
| var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7); |
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
| function ValidateEmail(email) { | |
| var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| return re.test(String(email).toLowerCase()); | |
| } |
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
| /** | |
| * Searches for the next possible monday and returns it. To change the desired weekday - change line 7 "days.xxxx". | |
| */ | |
| const days = { | |
| // "sunday": 0, // << if sunday is first day of week | |
| "monday": 1, | |
| "tuesday": 2, | |
| "wednesday": 3, | |
| "thursday": 4, | |
| "friday": 5, |
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
| function toIsoString(date_param) { | |
| if (date_param === undefined || date_param === null)return '' | |
| if(!((date_param instanceof Date) || (typeof date_param ==="string"))) throw new Error(`Illegal Argument of type ${typeof date_param} on method toIsoString! Expected date or string.`) | |
| let date = new Date(date_param) | |
| var tzo = -date.getTimezoneOffset(), | |
| dif = tzo >= 0 ? '+' : '-', | |
| pad = function (num) { | |
| return (num < 10 ? '0' : '') + num |
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 os | |
| #avoid the character >"< in your passwords | |
| pwds = """ | |
| my-secret1: value1 | |
| my-secret2: value2 | |
| """.split("\n") | |
| for line in pwds: | |
| if not line: continue |