This is a gist.io writing test.
This file contains hidden or 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 { 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; |
This file contains hidden or 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 { 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) |
This file contains hidden or 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 { 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" |
This file contains hidden or 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 {Children, type ReactNode} from 'react'; | |
| type RenderFn<T> = (item: T, index?: number) => ReactNode; | |
| export const For = <T,>({ | |
| render, | |
| each = [], | |
| }: { | |
| render: RenderFn<T>; | |
| each?: T[]; |
This file contains hidden or 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
| 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[] { |
This file contains hidden or 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
| 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] || ''; | |
| }; |
This file contains hidden or 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 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; | |
| } |
This file contains hidden or 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
| 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>, |
This file contains hidden or 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 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[] = []; |
NewerOlder