Skip to content

Instantly share code, notes, and snippets.

View bennobuilder's full-sized avatar
👋
stay curious

Benno bennobuilder

👋
stay curious
View GitHub Profile
import { Err, Ok, TResult } from 'tuple-result';
import { crispConfig, logger } from '@/environment';
import { AppError } from '../AppError';
// https://github.com/crisp-im/crisp-sdk-web
// Note: Custom wrapper instead of official SDK due to:
// - Limited support for multiple event listeners
// - Missing method to check if support members are online
// - Need for better TypeScript integration and type safety
export class Crisp {
@bennobuilder
bennobuilder / use-css-variable.ts
Created March 27, 2025 15:16
use-css-variable
'use client';
import React, { useId } from 'react';
export function useCssVariable<GValue extends string | number>(
elementRef: React.RefObject<HTMLElement | null>,
config: TCssVariableConfig<GValue> | (() => TCssVariableConfig<GValue>),
deps: React.DependencyList = []
) {
const id = useId();
@bennobuilder
bennobuilder / gist:6781a3c5b21d2a24621fb3d9f64c2e8f
Created October 23, 2024 05:09
Why Math.atan2(0, -1) Returns -90 Degrees Instead of 0 for a Falling Object
The reason it's -90 degrees rather than 0 is because atan2 uses the standard mathematical coordinate system where:
The x-axis runs horizontally (right is positive)
The y-axis runs vertically (up is positive)
Angles are measured counterclockwise from the positive x-axis
In this system:
0 degrees points to the right (positive x-axis)
90 degrees points up (positive y-axis)