Skip to content

Instantly share code, notes, and snippets.

View wmentha's full-sized avatar
🏧
FEED ME A STRAY CAT

WJKM wmentha

🏧
FEED ME A STRAY CAT
View GitHub Profile
@wmentha
wmentha / base10Length.js
Created November 3, 2023 04:01
Get the length of a base 10 number
const base10Length = function (n) {
let nn = BigInt(n);
let a = 1n;
let b = 1n;
for (;;) {
const c = BigInt(10n * a);
if (c > nn) {
return Number(b);
}
a = c;
@wmentha
wmentha / App.svelte
Last active July 11, 2022 04:12
HTMLElement Title Attribute Binding - Svelte
<script>
import Title from './Title.svelte';
</script>
<Title tag={ 'h1' }>Hello world!</Title>
<Title tag={ 'h2' }>Hello world!</Title>
<Title tag={ 'h3' }>Hello world!</Title>
<Title tag={ 'h4' }>Hello world!</Title>
<Title tag={ 'h5' }>Hello world!</Title>
<Title tag={ 'h6' }>Hello world!</Title>
@wmentha
wmentha / clamp.d.ts
Last active July 11, 2022 01:35
Typescript Clamp Function
export declare type NumOrBigInt = (bigint | number);
export declare type GenericNumber<T> = {
value: T;
limit1: T;
limit2: T;
};
export declare type NumberClamp = GenericNumber<number>;
export declare type BigIntClamp = GenericNumber<bigint>;
export declare function clamp({ value, limit1, limit2 }: NumberClamp | BigIntClamp): NumOrBigInt;
@wmentha
wmentha / CODE_OF_CONDUCT.md
Last active June 21, 2022 12:09
Abbreviated Contributor Covenant Code of Conduct 2.0

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for all.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

@wmentha
wmentha / convertor.jsonc
Created April 30, 2022 11:34
Unit Converter: Angle, Area, Data, Data, Energy, Length, Power, Pressure, Speed, Temperature, Time, Volume, Weight (Mass)
// Copyright © WJKM 2022 https://github.com/wmentha
// SPDX-License-Identifier: MIT
// Source: https://github.com/microsoft/calculator/blob/e9a974d1dd4333f0e99f4d61b9d5e179a50f274b/src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp#L775-L936
{
"Angle": [
{
"unit": "Degree",
"value": 1,
"abbreviation": "deg"