Skip to content

Instantly share code, notes, and snippets.

View schickling's full-sized avatar
Making the web better

Johannes Schickling schickling

Making the web better
View GitHub Profile
@schickling
schickling / flake.nix
Created January 18, 2024 15:15
Node.js 16 Nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
nixpkgsOld.url = "github:NixOS/nixpkgs/release-23.05";
nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgsOld, nixpkgsUnstable, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
import { describe, expect, it } from 'vitest'
import { Equal } from '../index.js'
import * as Schema from './index.js'
import { JsonWrapper, jsonWrapper } from './SchemaJsonWrapper.js'
describe('wrapper', () => {
it('wrapper', () => {
const wrapped = jsonWrapper(Schema.number)
const decoded = Schema.parseSync(wrapped)(10)
/* eslint-disable prefer-arrow/prefer-arrow-functions */
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/// <reference lib="dom" />
import type { RuntimeFiber } from '@effect/io/Fiber'
import * as FiberRef from '@effect/io/FiberRef'
import * as Scheduler from '@effect/io/Scheduler'
@schickling
schickling / flake.nix
Created September 28, 2023 13:00
Node.js 16 Nix flake
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
import type { Otel, Scope } from '@overtone/utils/effect'
import { Duration, Effect, Either, pipe, Request, RequestResolver } from '@overtone/utils/effect'
export type MakeArgs<TTag extends string, C, E, A, E2, A2> = {
tag: TTag
fetchResources: (resourceIds: ReadonlyArray<string>) => Effect.Effect<C, E, A[]>
mapResult?: (fetchedResources: A) => Either.Either<E2, A2>
batchTimeoutMs?: number
batchCapacity: number
cache?: {
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'
import * as Otel from './Otel/index.js'
import * as Data from '@effect/data/Data'
import { pipe } from '@effect/data/Function'
import * as Effect from '@effect/io/Effect'
import * as msgpack from 'msgpackr'
import * as Otel from './Otel/index.js'
export const fetchHead = (
url: string | URL,
headers?: HeadersInit,
@schickling
schickling / flake.nix
Last active August 7, 2023 14:20
Random Node Effect image utils
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
import * as Data from '@effect/data/Data'
import { pipe } from '@effect/data/Function'
import * as Effect from '@effect/io/Effect'
import * as msgpack from 'msgpackr'
import * as Otel from './Otel/index.js'
export const fetchHead = (
url: string | URL,
headers?: HeadersInit,
/* eslint-disable prefer-arrow/prefer-arrow-functions */
export * from '@effect/io/Scheduler'
import * as Scheduler from '@effect/io/Scheduler'
// Based on https://github.com/Effect-TS/io/blob/main/src/Scheduler.ts#L63
export class ReactAwareScheduler implements Scheduler.Scheduler {
private running = false
private tasks = new Array<Scheduler.Task>()