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 / otel-investigation.md
Last active July 23, 2025 07:00
Investigation: OpenTelemetry Node.js HostDetector import issue in Cloudflare Workers

OpenTelemetry Node.js HostDetector Import Issue in Cloudflare Context

Problem

The Node.js-specific HostDetector from @opentelemetry/resources is being imported in a Cloudflare Workers test environment, causing compatibility issues.

Error Location: /Users/schickling/Code/livestore/cloudflare-adapter/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/HostDetector.js

Test File: /Users/schickling/Code/livestore/cloudflare-adapter/tests/integration-cloudflare/src/hibernation.test.ts

Root Cause Analysis

@schickling
schickling / .envrc
Created July 7, 2025 09:33
Expo/React Native CI Testing: Nix + Maestro Best Practices - Complete setup for automated iOS testing with intelligent detection, performance optimization, and reproducible environments. Saves 8+ seconds per test run with 28% performance improvement.
use flake
# Fix SDK conflicts between Nix and Xcode
unset SDKROOT NIX_APPLE_SDK_VERSION NIX_LDFLAGS NIX_CFLAGS_COMPILE 2>/dev/null || true
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
tags level
best-practices
typescript
boolean
warn

Enforce Explicit Value Comparisons

Detects shorthand value usage patterns (implicit truthiness/falsiness checking) in JavaScript/TypeScript code. This rule helps identify places where explicit comparisons might be preferred for clarity and type safety. Common cases include checking for undefined/null, empty strings, zero values, and boolean states.

import { spawn } from 'node:child_process'
import process from 'node:process'
const run = (cmd: string, args: string[], forwardStdin = true) =>
spawn(cmd, args, {
shell: true,
stdio: [forwardStdin ? 'inherit' : 'ignore', 'inherit', 'inherit'],
})
const processes = [
@schickling
schickling / ChildProcessRunner.ts
Created December 18, 2024 14:45
Effect Node Child Process Worker
/* eslint-disable prefer-arrow/prefer-arrow-functions */
import process from 'node:process'
import { WorkerError } from '@effect/platform/WorkerError'
import * as Runner from '@effect/platform/WorkerRunner'
import * as Context from 'effect/Context'
import * as Deferred from 'effect/Deferred'
import * as Effect from 'effect/Effect'
import * as Exit from 'effect/Exit'
import * as FiberId from 'effect/FiberId'
@schickling
schickling / fix-lock-file.yml
Created November 9, 2024 16:34
GitHub action fix pnpm lock file
name: Fix Lock File and Create PR
on:
push:
branches:
- '**' # Run on every branch push
permissions:
contents: write
pull-requests: write
{ lib, stdenv, fetchurl, unzip }:
let
# https://docs.dagger.io/install
version = "0.12.5"; # Replace with the actual version you want to install
system = stdenv.hostPlatform.system;
# Map Nix system to Dagger's OS and architecture naming
systemMap = {
"x86_64-linux" = { os = "linux_amd64"; sha256 = ""; };
@schickling
schickling / Uint8ArrayList.ts
Created August 12, 2024 13:46
Effect schema Uint8ArrayList
import { Schema } from '@effect/schema'
/**
* The encoded structure is alternating 4 bytes to represent the length of the following Uint8Array,
* followed by the Uint8Array itself, repeated.
*/
export const Uint8ArrayList = Schema.transform(Schema.Uint8ArrayFromSelf, Schema.Array(Schema.Uint8ArrayFromSelf), {
decode: (encodedArrayList) => {
const arrayList: Uint8Array[] = []
@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)