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 {useEffect, useMemo, useRef, useState} from "react"; | |
const getStorageMap = (storageGetter) => { | |
let storage; | |
try { | |
storage = storageGetter(); | |
} catch { | |
return { | |
storageGet() { | |
return null; |
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
let subdomain = SUBDOMAIN; | |
let segmentQuery = { | |
$and: [ | |
{ startedAt: { op: "gte", value: "2020-11-03T23:00:00.000Z" } }, | |
{ startedAt: { op: "lt", value: "2020-12-01T23:00:00.000Z" } }, | |
], | |
user: { name: ["daniel","tom","Alex"] }, | |
}; |
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 {Nominal} from "../types"; | |
import PouchDB from "pouchdb-browser"; | |
import LRU from "lru-cache"; | |
export type GroupId = Nominal<string, "GroupId">; | |
export type GroupOverviewEntry = { | |
name: string; | |
createdAt: Date; | |
}; |
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
let subdomain = YOUR_SUBDOMAIN; | |
let CARD_ID='123' | |
// turns the string representation of a card id into a number. | |
// `111` will become 1, `15z` will become 140 | |
let convertIdToNumber = (seq) => { | |
let startVal = 28 * 29 - 1; | |
let implicitZero= true; | |
let letters = "123456789acefghijkoqrsuvwxyz"; | |
let length = letters.length; |
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
let subdomain = "MYSUBDOMAIN"; // for e.g. MYSUBDOMAIN.codecks.io | |
let cardQuery = {cardCreatedAt: {op: "gt", value: "2022-10-20"}}; | |
// build up the nested query and define which models and fields we want to receive | |
let query = { | |
_root: [ | |
{ | |
account: [ | |
{ |
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 lettersToSequence = ( | |
letters: string, | |
{startVal = 0, implicitZero = false}: {startVal: number; implicitZero: boolean} = { | |
startVal: 0, | |
implicitZero: false, | |
} | |
) => { | |
const length = letters.length; | |
const letterToIndex = letters.split("").reduce((memo, letter, index) => { | |
memo[letter] = index; |
OlderNewer