Skip to content
View pushkine's full-sized avatar

Block or report pushkine

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse

Pinned Loading

  1. Cubic Bézier Javascript. Matches App... Cubic Bézier Javascript. Matches Apple WebKit/UnitBezier.h
    1
    /** MIT License github.com/pushkine/ */
    2
    function cubicBezier(x1: number, y1: number, x2: number, y2: number) {
    3
    	if (!(x1 >= 0 && x1 <= 1 && x2 >= 0 && x2 <= 1))
    4
    		throw new Error(`CubicBezier x1 & x2 values must be { 0 < x < 1 }, got { x1 : ${x1}, x2: ${x2} }`);
    5
    	const ax = 1.0 - (x2 = 3.0 * (x2 - x1) - (x1 *= 3.0)) - x1,
  2. Javascript spring solving algorithm.... Javascript spring solving algorithm. Solves real life damped harmonic oscillator physics equations as used in Apple iOS & many others. Tweak damping and stiffness for spring behavior, scale mass with value delta and set soft to force solution for a critically damped spring ( no bounce eased smooth ) . Play with this function's graph on www.desmos.com/calculator/urztjwk4dv
    1
    /** MIT License github.com/pushkine/ */
    2
    interface SpringParams {
    3
    	mass?: number; // = 1.0
    4
    	damping?: number; // = 10.0
    5
    	stiffness?: number; // = 100.0
  3. Javascript color conversion algorith... Javascript color conversion algorithms. Complete HEX, HSL, RGB and named css color parsing & interpolation in the HCL color space. All constants directly sourced from the google/chromium open source project. Play, compare and benchmark against d3 on https://svelte.dev/repl/0a40a8348f8841d0b7007c58e4d9b54c
    1
    type RGBA = [number, number, number, number];
    2
    const rgb255 = (v: number) => (v < 255 ? (v > 0 ? v : 0) : 255);
    3
    const b1 = (v: number) => (v > 0.0031308 ? v ** (1 / 2.4) * 269.025 - 14.025 : v * 3294.6);
    4
    const b2 = (v: number) => (v > 0.2068965 ? v ** 3 : (v - 4 / 29) * (108 / 841));
    5
    const a1 = (v: number) => (v > 10.314724 ? ((v + 14.025) / 269.025) ** 2.4 : v / 3294.6);
  4. Styles and colors for CLIs in TypeSc... Styles and colors for CLIs in TypeScript. Try it on https://replit.com/@pushkine/ColdTautSpools#index.ts
    1
    /** MIT License github.com/pushkine */
    2
    export const color = (function <C extends readonly any[], M extends {}>(colors: C, mods: M) {
    3
        const fn = (c1: number, c2: number, str: string) => `\x1b[${c1}m${str}\x1b[${c2}m`;
    4
        const fnc = (c1: number, str: string) => fn(c1, 39, str.replace(/\x1b\[39m/g, `\x1b[${c1}m`));
    5
        const obj = { unstyle: (str: string) => str.replace(/\x1b\[[0-9]{1,2}m/g, ""), grey: fnc.bind(null, 90) };
  5. benchmarks.md benchmarks.md
    1
    https://jsbench.me/user/pushkine