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 TOKEN = "...." // your github access token | |
| const owner = "..." // your github name | |
| const blackList = [] // the names of the repos you don't want to process | |
| const { Octokit } = require("@octokit/rest") // install this first | |
| const octokit = new Octokit({ auth: TOKEN }) | |
| const fs = require("fs") |
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 loadmore_condition = (button) => button.innerText.includes('Load more'); | |
| const status_element = document.createElement('div'); | |
| status_element.innerText = 'Opening conversations ...'; | |
| status_element.style = | |
| 'position: fixed; z-index: 100; top: 1rem; left: 1rem; background-color: white; color: black; border: 1px solid black; padding: 0.5rem 1rem;'; | |
| document.body.appendChild(status_element); | |
| async function open_conversations() { |
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
| /* | |
| This Google script needs to be added to a Google spreadsheet. | |
| It lists all calendar entries within one year (that time range is configurable) | |
| and adds them to the first sheet in the spreadsheet. The script also adds | |
| a button 'Update' in the spreadsheet's UI that executes the main update function. | |
| */ | |
| const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
| const sheet = spreadsheet.getSheets()[0]; |
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
| type Tuple<Length extends number, T, Accumulator extends T[] = []> = | |
| Accumulator["length"] extends Length ? | |
| Accumulator : | |
| Tuple<Length,T,[...Accumulator,T]>; | |
| const example: Tuple<3,string> = ["hi","mom","!"]; |
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
| // 1. Example: get last element of any array | |
| function last_element<X>(arr: Array<X>): X { | |
| return arr[arr.length - 1]; | |
| } | |
| // 2. Example: get id of an object which has an id | |
| type person = { | |
| name: string; |
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 type { Redis } from "ioredis"; | |
| /** | |
| * This is a general decorator function that caches the | |
| * return value of a function for a specified amount of time | |
| * inside of a redis database. This can be used | |
| * to save responses from API requests, for example. | |
| * Caveat: This function is not typesafe, since we don't know | |
| * which type of data is saved in the redis database. | |
| * @param fun any function (without arguments) |
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
| /** | |
| * This is a general decorator function which caches the | |
| * return value of a function for a specified amount of time. | |
| * This can be used to save responses from API requests for example. | |
| * @param fun any function (without arguments) | |
| * @param duration caching duration in milliseconds | |
| * @returns the function return value when the cache is empty or old, or the cache value | |
| */ | |
| export function cached<T>(fun: () => T, duration: number) { | |
| let date: Date | null = null; |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>SVG with flipped coordinate system</title> | |
| <style> | |
| body { | |
| font-family: Arial, Helvetica, sans-serif; |
NewerOlder