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 { pipe } from '@effect/data/Function' | |
| import * as Option from '@effect/data/Option' | |
| import * as Cause from '@effect/io/Cause' | |
| import * as Effect from '@effect/io/Effect' | |
| import * as Exit from '@effect/io/Exit' | |
| import * as Fiber from '@effect/io/Fiber' | |
| import * as Queue from '@effect/io/Queue' | |
| import * as Stream from '@effect/stream/Stream' | |
| export const chainSwitch = |
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 makeEtaState = () => { | |
| type TimestampInSeconds = number | |
| const countBucketsForLast10Seconds: Map<TimestampInSeconds, number> = new Map() | |
| const countRun = (numberOfItems: number) => { | |
| const timestampInSeconds = Math.floor(Date.now() / 1000) | |
| const count = countBucketsForLast10Seconds.get(timestampInSeconds) ?? 0 | |
| countBucketsForLast10Seconds.set(timestampInSeconds, count + numberOfItems) | |
| } |
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 from 'react' | |
| /** | |
| * A variant of `React.useState` which allows the `inputState` to change over time as well. | |
| * Important: This hook is synchronous / single-render-pass (i.e. doesn't use `useEffect` or `setState` directly). | |
| * | |
| * Notes: | |
| * - The output state is always reset to the input state in case the input state changes (i.e. the previous "external" `setStateAndRerender` call is forgotten) | |
| * - This hook might not work properly with React Suspense | |
| * - Also see this Tweet for more potential problems: https://twitter.com/schickling/status/1677317711104278528 |
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
| { lib, rev, pkgs ? import <nixpkgs> { } }: | |
| let | |
| inherit (pkgs) fetchzip lib stdenv; | |
| inherit (pkgs.stdenv) mkDerivation; | |
| inherit (pkgs.stdenv.hostPlatform) system; | |
| selectSystem = attrs: | |
| attrs.${system} or (throw "Unsupported system: ${system}"); |
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
| /* eslint-disable prefer-arrow/prefer-arrow-functions */ | |
| import type * as otel from '@opentelemetry/api' | |
| const noopSpan = { | |
| setAttribute: () => null, | |
| setAttributes: () => null, | |
| addEvent: () => null, | |
| setStatus: () => null, | |
| updateName: () => null, | |
| recordException: () => null, |
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 { describe, expect, it } from 'vitest' | |
| import { Equal } from './index.js' | |
| import * as Schema from './Schema.js' | |
| import { Wrapper, wrapper } from './SchemaWrapper.js' | |
| describe('wrapper', () => { | |
| it('wrapper', () => { | |
| const wrapped = wrapper(Schema.number) | |
| const decoded = Schema.parse(wrapped)(10) |
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 from 'react' | |
| const PR = Math.round(window.devicePixelRatio || 1) | |
| const FRAME_BAR_WIDTH = 2 | |
| export type FPSMeterProps = { | |
| width?: number | |
| height?: number | |
| systemFps?: number |
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
| /* eslint-disable prefer-arrow/prefer-arrow-functions */ | |
| /** | |
| * fork of https://github.com/astoilkov/main-thread-scheduling | |
| * | |
| * node compatibility | |
| * removal of visible priority | |
| * reversal of task order | |
| */ | |
| import * as Effect from '@effect/io/Effect' |
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
| // /// <reference no-default-lib="true" /> | |
| /// <reference lib="esnext" /> | |
| /// <reference lib="webworker" /> | |
| import { casesHandled } from '@mytunes/utils' | |
| import { Effect, Either, Layer, Otel, pipe, ServiceContext, Stream, WorkerLive } from '@mytunes/utils/effect' | |
| import { OtelMeterLive, OtelTracerLive } from '@mytunes/utils-frontend/tracing' | |
| import type { | |
| EventId, |
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 * as Chunk from '@effect/data/Chunk' | |
| import * as Context from '@effect/data/Context' | |
| import * as Duration from '@effect/data/Duration' | |
| import type * as Either from '@effect/data/Either' | |
| import { pipe } from '@effect/data/Function' | |
| import * as Deferred from '@effect/io/Deferred' | |
| import * as FiberRefs from '@effect/io/FiberRefs' | |
| import * as Queue from '@effect/io/Queue' | |
| import * as Effect from './Effect.js' |