Skip to content

Instantly share code, notes, and snippets.

@mchlggr
mchlggr / index.ts
Created June 13, 2025 04:41 — forked from Fredx87/index.ts
@effect/platform @effect/schema Cloudflare Worker example
import * as Http from "@effect/platform/HttpServer";
import { Effect } from "effect";
import * as S from "@effect/schema/Schema";
const HttpLive = Http.router.empty.pipe(
Http.router.get("/", Http.response.text("Hello World")),
Http.router.get(
"/todo/:id",
Effect.gen(function* ($) {
const { id } = yield* $(
export const speakText = async (text: string, apiKey: string): Promise<void> => {
let ws: WebSocket | null = null;
let audioContext: AudioContext | null = null;
let mediaStreamDestination: MediaStreamAudioDestinationNode | null = null;
let scriptProcessorNode: ScriptProcessorNode | null = null;
let audioElement: HTMLAudioElement | null = null;
let buffer: Float32Array = new Float32Array();
const API_VERSION = "2024-06-10";
const SAMPLE_RATE = 44100;
@mchlggr
mchlggr / keybase.md
Created April 23, 2024 17:49
keybase.md

Keybase proof

I hereby claim:

  • I am mchlggr on github.
  • I am metaobject (https://keybase.io/metaobject) on keybase.
  • I have a public key ASA7GCdKCaP6WJ0RmyS0EHHGiizJiz-Z2ldRuW5GBrufZQo

To claim this, I am signing this object:

@mchlggr
mchlggr / PinchZoomPan.js
Created April 22, 2024 02:54 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@mchlggr
mchlggr / yjs-shared-types.ts
Created April 15, 2024 21:39 — forked from colelawrence/yjs-shared-types.ts
YJs, TypeScript, "Shared Types" with zod-like parser inference
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
import * as Y from "yjs";
export interface ZodLikeParser<T> {
_type: T;
parse: (value: unknown) => T;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyValueDesign = ZodLikeParser<any> | CollectionDef<any> | RecordDef<any>;
@mchlggr
mchlggr / WebGL-WebGPU-frameworks-libraries.md
Created April 12, 2024 22:04 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@mchlggr
mchlggr / Instructions.md
Created March 31, 2024 22:30 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

How to Create a New User

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

newuser has no permissions to access any databases nor to login to MySQL shell.

Provide access to new user:

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

@mchlggr
mchlggr / mysql2-m1.md
Created December 5, 2023 21:06 — forked from fernandoaleman/mysql2-m1.md
How to install mysql2 gem on m1 Mac

Problem

Installing mysql2 gem errors on m1 Mac.

Solution

Make sure mysql, openssl and zstd are installed on Mac via Homebrew.

brew install mysql openssl zstd
@mchlggr
mchlggr / ranger-cheatsheet.md
Created June 15, 2023 00:11 — forked from heroheman/ranger-cheatsheet.md
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts