This file contains 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
/** | |
* @param {Window} globalScope | |
* @return {typeof $NAME$} | |
*/ | |
export function def$NAME$({ HTMLElement, customElements }) { | |
class $NAME$ extends HTMLElement { | |
static register(tagName = "$TAG$") { | |
this.tagName = tagName; | |
customElements.define(tagName, this); | |
} |
This file contains 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 { S3 } from "@aws-sdk/client-s3"; | |
import { partition } from "@thi.ng/transducers"; | |
import md5File from "md5-file"; | |
import mimetypes from "mime-types"; | |
import fs from "node:fs"; | |
import path from "node:path"; | |
function* getFiles(dir) { | |
const entries = fs.readdirSync(dir, { withFileTypes: true }); | |
for (const file of entries) { |
This file contains 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
display_information: | |
name: CircleCI | |
description: CircleCI status bot | |
background_color: "#292929" | |
features: | |
bot_user: | |
display_name: CircleCI | |
always_online: false | |
oauth_config: | |
scopes: |
This file contains 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
/* https://go.tacodewolff.nl/minify */ | |
enScroll=!1;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{};function a(){const k="G-XXXXXXXXXX",t=()=>Math.floor(Math.random()*1e9)+1,n=()=>Math.floor(Date.now()/1e3),y=()=>(sStor._p||(sStor._p=t()),sStor._p),v=()=>t()+"."+n(),p=()=>(lStor.cid_v4||(lStor.cid_v4=v()),lStor.cid_v4),m=lStor.getItem("cid_v4"),u=()=>m?void 0:enScroll==!0?void 0:"1",l=()=>(sStor.sid||(sStor.sid=n()),sStor.sid),d=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},r="1",h=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +r,sStor.sct=x;else sStor.sct=r;return sStor.sct},e=docLoc.search,f=new URLSearchParams(e),a=["q","s","search","query","keyword"],g=a.some(t=>e.includes("&"+t+"=")||e.includes("?"+t+"=")),i=()=>g==!0?"view_search_results":enScroll==!0?"scroll":"page_view",b=()=>enScroll==!0?"90":void |
This file contains 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
/** | |
* Converts Alpha‑2 country code (ISO 3166) to unicode flag emoji | |
* @param {String} countryCode | |
* @returns {String} | |
*/ | |
export function flagEmoji(countryCode) { | |
const s = countryCode.toUpperCase(); | |
return String.fromCodePoint( | |
127397 + s.charCodeAt(0), | |
127397 + s.charCodeAt(1) |
This file contains 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
/** | |
* @param {Element} el | |
*/ | |
function parse(el) { | |
const parsedJSON = JSON.parse(el.textContent); | |
if (Array.isArray(parsedJSON)) return parsedJSON; | |
return [parsedJSON]; | |
} | |
/** |
This file contains 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
/** | |
* Reads the response text in given text encoding. | |
* When charset isn't defined on `content-type` header it falls back to `utf-8`. | |
* @param {Response} resp | |
* @returns {string} | |
*/ | |
async function readTextResponse(resp) { | |
const contentType = resp.headers.get("content-type"); | |
const [, charset] = contentType?.split("charset="); | |
const decoder = new TextDecoder(charset ?? "utf-8"); |
This file contains 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
<midi app=" 2.5.12.690"> | |
<control channel="14" event_type="Note On" control="20"> | |
<userio event="click"> | |
<play deck_set="Default" deck_id="1" slot_id="0"> | |
<translation action_on="press" behaviour="toggle"/> | |
</play> | |
</userio> | |
<userio event="output"> | |
<play deck_set="Default" deck_id="1" slot_id="0"> | |
<translation action_on="any"> |
This file contains 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 reorderFields = headers => row => headers.map(key => row[key]); | |
const rowFormatter = row => | |
row.map(v => `"${String(v).replaceAll(`"`, `""`)}"`).join(","); | |
const arrayToCsv = data => data.map(rowFormatter).join("\r\n"); | |
export function writeToString(rows, options) { | |
const { headers, transform = x => x } = options; | |
const data = rows.map(transform).map(reorderFields(headers)); | |
return arrayToCsv([headers].concat(data)); | |
} |
This file contains 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
export function registrationNumberValidator(regNr) { | |
if (!regNr || (typeof regNr !== "string") || regNr.length !== 8) return false; | |
const [n8, n7, n6, n5, n4, n3, n2, x] = regNr.split("").map(Number); | |
return ( | |
x === | |
(11 - | |
((8 * n8 + 7 * n7 + 6 * n6 + 5 * n5 + 4 * n4 + 3 * n3 + 2 * n2) % 11)) % | |
10 | |
); | |
} |
NewerOlder