Skip to content

Instantly share code, notes, and snippets.

View OrderAndCh4oS's full-sized avatar
🕰️
Writing code

Sean Cooper OrderAndCh4oS

🕰️
Writing code
View GitHub Profile
@OrderAndCh4oS
OrderAndCh4oS / fetch-audio-src
Created November 10, 2021 22:57
Fetch audio src
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);
};
I am attesting that this GitHub handle OrderAndCh4oS is linked to the Tezos account tz1iM7PB4brTmkbTUccsrXYjepSQ6ext7KYu for tzprofiles
sig:edsigtdsPStL8c1MGmAVCPn3PnEypvFLww1V4GGxZjvAcGE9vrKgfpTKuDLSZqBqmf1oDsY7jvioNgxq7BXvrKR3bLSwnfnqcvn
@OrderAndCh4oS
OrderAndCh4oS / get-burns.js
Created August 9, 2021 16:20
get-burns.js
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&parameter.[0].txs.[0].token_id=${objktId}&parameter.[0].txs.[0].to_=tz1burnburnburnburnburnburnburjAYjjX&select=id,hash,parameter`);
const data = await response.json();
let i = 1;
return data.reduce((arr, d) => {
@OrderAndCh4oS
OrderAndCh4oS / index.js
Created May 1, 2021 16:43
hicetnunc update _block_levels lookup obj
import fetch from 'node-fetch';
import fs from 'fs';
const blockLevels = {
0: 1365242
};
let tokenId = 1000;
while(true) {
@OrderAndCh4oS
OrderAndCh4oS / iso-639-2-lookup.json
Last active August 23, 2022 22:48
iso-639-2 language code to iso-639-1 look up json
{
"abk": {
"iso-639-2": "abk",
"iso-639-1": "ab",
"english": "Abkhazian",
"french": "abkhaze",
"german": "Abchasisch"
},
"ace": {
"iso-639-2": "ace",
@OrderAndCh4oS
OrderAndCh4oS / iso-639-1-lookup.json
Last active August 23, 2022 22:47
iso-639-1 language code to iso-639-2 look up json
{
"ab": {
"iso-639-2": [
"abk"
],
"iso-639-1": "ab",
"english": "Abkhazian",
"french": "abkhaze",
"german": "Abchasisch"
},
@OrderAndCh4oS
OrderAndCh4oS / trie.js
Last active March 11, 2021 19:27
Javascript Trie
class CharNode {
_char;
_phonetics = new Set();
_nextCharsLevel = {};
constructor(char) {
this._char = char;
}
get phoneticsLength() {
@OrderAndCh4oS
OrderAndCh4oS / iso-3166-country-codes.ts
Last active August 23, 2022 22:46
ISO 3166 Country Codes Typescript Object JSON
// https://www.iso.org/obp/ui/#search
const isoCountryCodes = [
{name: 'Andorra', alphaTwoCode: 'AD', alphaThreeCode: 'AND', numeric: '020'},
{name: 'United Arab Emirates', alphaTwoCode: 'AE', alphaThreeCode: 'ARE', numeric: '784'},
{name: 'Afghanistan', alphaTwoCode: 'AF', alphaThreeCode: 'AFG', numeric: '004'},
{name: 'Antigua and Barbuda', alphaTwoCode: 'AG', alphaThreeCode: 'ATG', numeric: '028'},
{name: 'Anguilla', alphaTwoCode: 'AI', alphaThreeCode: 'AIA', numeric: '660'},
{name: 'Albania', alphaTwoCode: 'AL', alphaThreeCode: 'ALB', numeric: '008'},
{name: 'Armenia', alphaTwoCode: 'AM', alphaThreeCode: 'ARM', numeric: '051'},
{name: 'Angola', alphaTwoCode: 'AO', alphaThreeCode: 'AGO', numeric: '024'},
@OrderAndCh4oS
OrderAndCh4oS / stripe-test-cards-json.ts
Created July 18, 2020 08:32
Stripe Test Card Data
const randomInteger = (min: number, max: number) =>
Math.floor(Math.random() * (max - min + 1)) + min;
export const getFutureExpiryDate = () => {
const now = new Date();
now.setFullYear(now.getFullYear() + randomInteger(1, 5));
return {month: randomInteger(1, 12), year: now.getFullYear().toString().slice(2)};
}
export const getPastExpiryDate = () => {
@OrderAndCh4oS
OrderAndCh4oS / stripe-test-cards-json.ts
Created July 18, 2020 08:32
Stripe Test Card Data
const randomInteger = (min: number, max: number) =>
Math.floor(Math.random() * (max - min + 1)) + min;
export const getFutureExpiryDate = () => {
const now = new Date();
now.setFullYear(now.getFullYear() + randomInteger(1, 5));
return {month: randomInteger(1, 12), year: now.getFullYear().toString().slice(2)};
}
export const getPastExpiryDate = () => {