Skip to content

Instantly share code, notes, and snippets.

import { LookupValue } from '@diqiq/policy-auto-ts-models';
import { LookupOption } from '@eisgroup/react-components';
interface VehicleFilters {
modelYear?: string[];
make?: string[];
}
interface ExtendedLookupValue extends LookupValue {
[key: string]: unknown;
const { exec } = require("child_process");
const { promisify } = require("util");
const path = require("path");
const execAsync = promisify(exec);
// Base directory for repositories
const baseDir = path.resolve("~/dev/projects");
// List of repositories (relative to baseDir)
const { exec } = require("child_process");
const path = require("path");
// Base directory for repositories
const baseDir = path.resolve("~/dev/projects");
// List of repositories (relative to baseDir)
const repositories = [
"repo-1",
"repo-2"
import {Children, type ReactNode} from 'react';
type RenderFn<T> = (item: T, index?: number) => ReactNode;
export const For = <T,>({
render,
each = [],
}: {
render: RenderFn<T>;
each?: T[];

Hello gist.io

This is a gist.io writing test.

type Nullable<T> = T | undefined | null;
function isDefined<T>(item: T): item is NonNullable<T> {
return item !== undefined && item !== null;
}
function compact<T, R>(
list: Nullable<T[]>,
mapFn: (item: NonNullable<T>) => Nullable<R>
): R[] {
@toky-nomena
toky-nomena / sort.ts
Last active September 18, 2024 18:13
function filterFn<T>(element: T | undefined): element is T {
return element !== undefined;
}
function sortMessagesByBindings(messages: (Message | null | undefined)[], bindings: string[]): Message[] {
// Helper function to get the last component of a string
const getLastComponent = (str: string): string => {
const parts = str.split('.');
return parts[parts.length - 1] || '';
};
import React, { useState, useEffect, useTransition } from 'react';
import { useQuery, useQueryClient, QueryFunction } from 'react-query';
import axios, { AxiosError } from 'axios';
import Select from 'react-select';
interface Option {
value: string;
label: string;
}
type Predicate<T> = (result: T) => boolean;
interface RetryOptions {
retries: number;
delay?: number; // optional delay between retries in milliseconds
}
async function retryPromise<T>(
promiseFactory: () => Promise<T>,
predicate: Predicate<T>,
export const matcher = <Input, Output>(value: Input) => {
type Result = (value: Input) => Output;
type Expression = (value: Input) => boolean;
interface MatchCases {
expression: Expression;
result: Result;
}
const cases: MatchCases[] = [];