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 randomInt = (max: number, min: number = 0): number => { | |
return Math.floor(Math.random() * (max - min)) + min; | |
}; | |
export const getRandomTimeToday = () => { | |
const date = new Date(); | |
date.setHours(randomInt(24)); | |
date.setMinutes(randomInt(60)); | |
date.setSeconds(randomInt(60)); | |
date.setMilliseconds(randomInt(1000)); |
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 str = 'onè, twö, three and, ö four. *%#@ four and three!!! 😍 💕, 👍👌\nblah blah blah hyphenated-word thing–endash and an—emdash a/slash some!!thing 10:00am'; | |
const countOccurrences = (str: string) => | |
Object.entries<number>( | |
str | |
.replace(/[\n\r–—/]+/g, ' ') | |
.replace(/[^\p{L}\p{N}\p{M}\p{Zs}\p{So}\s-]+/ug, '') | |
.replace(/\s\s+/g, ' ') | |
.split(' ') | |
.reduce((obj: any, word: string) => ( |
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
interface IValidationSchema { | |
[property: string]: (IValidateProperty | IValidateArray | IValidateObject) | |
} | |
interface IValidateArray { | |
required: boolean | |
type: 'array', | |
schema: IValidationSchema | |
} |
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 one = '{one}'; | |
const two = '{two}'; | |
const three = '{three}'; | |
const oneAndTwoAndThree = '{one} + {two} + {three}'; | |
const oneNotTwo = '{one} - {two}'; | |
const oneAndTwoNotThree = '{one} + {two} - {three}'; | |
const oneOrTwoOrThree = '{one} | {two} | {three}'; | |
const quoteAnalysisParser = (query: string, values: string[]) => { |
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 text = `Þig, sem í fjarlægð fjöllin bak við dvelur | |
og fagrar vonir tengdir líf mitt við, | |
minn hugur þráir, hjartað ákaft saknar, | |
er horfnum—stundum ljúfum dvel ég hjá. | |
Heyrirðu ei hvern hjartað kallar á? | |
Heyrirðu ei storm er kveðju mína ber? | |
Þú fagra minning eftir skildir eina, | |
sem aldrei gleymist, meðan lífs ég er.` | |
const enDashEmDashOrForwardSlash = /[\u2013\u2014/]/g; |
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 slugify = (str: string) => str | |
.normalize("NFD") | |
.replace(/[^\w\s]/g, '') | |
.trim() | |
.replace(/\s+/g, '-') | |
.toLowerCase() | |
; | |
console.log(slugify(' Blhä+ LFgha+áaf. asfaASF aFsfsf. ')); |
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 isObject = (obj?: unknown): obj is object => | |
Boolean(obj) && (obj?.constructor === Object); | |
console.log(isObject()); // false | |
console.log(isObject(null)); // false | |
console.log(isObject(true)); // false | |
console.log(isObject(1)); // false | |
console.log(isObject('str')); // false | |
console.log(isObject([])); // false | |
console.log(isObject(new Date)); // false |
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
fetchSrc = async(url, mimeType) => { | |
const audioResponse = await fetch(url, { | |
method: 'get', | |
headers: {'Accept': mimeType}, | |
}); | |
const blob = await audioResponse.blob(); | |
audio.mimeType = mimeType; | |
audio.preload = 'metadata'; | |
audio.src = URL.createObjectURL(blob); | |
}; |
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
I am attesting that this GitHub handle OrderAndCh4oS is linked to the Tezos account tz1iM7PB4brTmkbTUccsrXYjepSQ6ext7KYu for tzprofiles | |
sig:edsigtdsPStL8c1MGmAVCPn3PnEypvFLww1V4GGxZjvAcGE9vrKgfpTKuDLSZqBqmf1oDsY7jvioNgxq7BXvrKR3bLSwnfnqcvn |
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 fetch from 'node-fetch'; | |
import ObjectsToCsv from 'objects-to-csv'; | |
import path from 'path'; | |
const getBurns = async(objktId) => { | |
const response = await fetch( | |
`https://api.tzkt.io/v1/operations/transactions?target=KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton&entrypoint=transfer&status=applied&limit=10000¶meter.[0].txs.[0].token_id=${objktId}¶meter.[0].txs.[0].to_=tz1burnburnburnburnburnburnburjAYjjX&select=id,hash,parameter`); | |
const data = await response.json(); | |
let i = 1; | |
return data.reduce((arr, d) => { |
NewerOlder