Skip to content

Instantly share code, notes, and snippets.

@stephent
stephent / eulerRotation.c
Created March 16, 2023 03:24 — forked from sketchpunk/eulerRotation.c
Apply Euler Rotation on position & normals in GLSL
/*
vec3 rot = vec3( 90.0, 90.0, 0.0 );
vec3 pos = position * scale;
vec3 norm = normal;
eulerRotation( rot * DEG2RAD, pos, norm );
*/
const float DEG2RAD = 0.01745329251; // PI / 180
// Apply YXZ radian rotation
@stephent
stephent / ControlledSwitch.tsx
Last active December 19, 2022 10:03
General purpose switch component using headlessui, tailwind and react-hook-form
import { useController, UseControllerProps } from "react-hook-form";
import { Switch } from '@headlessui/react'
type Props = {
label?: string;
enabledLabel?: string;
disabledLabel?: string;
title?: string;
};
@stephent
stephent / Historical Time Zones.swift
Created May 7, 2019 21:06
Swift Playground showing unexpected output for historical time zone rules (using example of 8 July 1842 in Europe/Rome)
/**
Playground illustrating incorrect result for secondsFromGMT for 8 July 1842 in time zone Europe/Rome. A current date is included to illustrate that secondsFromGMT and the output of the date formatter are in agreement.
For 8 July 1842, expected output is:
Describing date: 1842-07-09 05:39:33 +0000
Seconds from GMT: 2996
Abbreviation: LMT
Formatted string: 6:29:29 AM Jul 09, 1842, GMT+00:49:56