Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Okiki Ojo okikio

🏠
Working from home
View GitHub Profile
@okikio
okikio / bundlejs_core.mjs
Last active February 14, 2023 17:40
The bundled src code for @bundlejs/core
View bundlejs_core.mjs
This file has been truncated, but you can view the full file.
var P5=Object.create;var s3=Object.defineProperty;var h5=Object.getOwnPropertyDescriptor;var d5=Object.getOwnPropertyNames;var K5=Object.getPrototypeOf,H5=Object.prototype.hasOwnProperty;var H1=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var z1=(e,t)=>()=>(e&&(t=e(e=0)),t);var U5=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n1=(e,t)=>{for(var n in t)s3(e,n,{get:t[n],enumerable:!0})},S5=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of d5(t))!H5.call(e,a)&&a!==n&&s3(e,a,{get:()=>t[a],enumerable:!(r=h5(t,a))||r.enumerable});return e};var V2=(e,t,n)=>(n=e!=null?P5(K5(e)):{},S5(t||!e||!e.__esModule?s3(n,"default",{value:e,enumerable:!0}):n,e));var p2=U5((y8,T0)=>{"use strict";var c3=Object.defineProperty,u5=Object.getOwnPropertyDescriptor,j5=Object.getOwnPropertyNames,R5=Object.pro
@okikio
okikio / lzuint8array.js
Created February 14, 2023 05:21 — forked from JobLeonard/lzuint8array.js
Uint8Array to LZ-string and back
View lzuint8array.js
const LZuint8Array = (function () {
/*
basic ranges of printable UTF16 values (as found in LZ-string):
[32, 127), [160, 55296), [63744, 65536)
We also have filter out string characters like:
" (34)
' (39)
` (44)
(Forward tick is safe: ´ (96))
So:
@okikio
okikio / README.md
Last active January 10, 2023 06:51
uint8array-to-utf-8.ts
View README.md
@okikio
okikio / beta-distribution.ts
Last active January 4, 2023 02:25
beta-distribution.ts
View beta-distribution.ts
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
View 0027-pre-compiled-ssr-templates.md

Pre-compiled Astro SSR templates

To op Generate Partially Static SSR Page for faster compile

@okikio
okikio / resolve-imports.js
Last active April 15, 2022 16:43
A fork of resolve.exports but for the imports field of package.json
View resolve-imports.js
/** resolve.exports but for imports */
/**
* @param {object} imports
* @param {Set<string>} keys
*/
function loop(imports, keys) {
if (typeof imports === 'string') {
return imports;
}
@okikio
okikio / bezier-easing.ts
Last active September 25, 2022 15:42
custom-easing.ts - a set of easing functions that generate arrays of tweens/frames; when placed in an animation framework/library they emulate animations using said easing function. Since, the easing frames can be placed are generated on initial run and almost every conventional animation library/framework supports multiple animation frames, you…
View bezier-easing.ts
/**
* https://github.com/gre/bezier-easing
* BezierEasing - use bezier curve for transition easing function
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
*/
// These values are established by empiricism with tests (tradeoff: performance VS precision)
export const NEWTON_ITERATIONS = 4;
export const NEWTON_MIN_SLOPE = 0.001;
export const SUBDIVISION_PRECISION = 0.0000001;
@okikio
okikio / script.ts
Last active October 19, 2021 15:18
ts-server.js
View script.ts
importScripts("https://unpkg.com/@typescript/vfs@1.3.5/dist/vfs.globals.js");
importScripts(
"https://cdnjs.cloudflare.com/ajax/libs/typescript/4.4.3/typescript.min.js"
);
importScripts("https://unpkg.com/@okikio/emitter@2.1.7/lib/api.js");
export type VFS = typeof import("https://cdn.esm.sh/@typescript/vfs");
export type EVENT_EMITTER = import("https://cdn.esm.sh/@okikio/emitter").EventEmitter;
export type Diagnostic = import("https://cdn.esm.sh/@codemirror/lint").Diagnostic;
@okikio
okikio / WebWorker.ts
Created October 13, 2021 14:22
A WebWorker/SharedWorker compatibility class you can use to polyfill/ponyfill the SharedWorker class in unsupported environments. This follows the Web standard, so, it doesn't support Nodejs's WorkerThreads.
View WebWorker.ts
// WebWorker/SharedWorker compatability class from https://github.com/okikio/bundle/blob/main/src/ts/util/WebWorker.ts
export class WebWorker implements EventTarget, AbstractWorker {
static SharedWorkerSupported = "SharedWorker" in globalThis;
ActualWorker: SharedWorker | Worker;
constructor(url: string | URL, opts?: WorkerOptions) {
if (WebWorker.SharedWorkerSupported) {
this.ActualWorker = new SharedWorker(url, opts);
} else {
this.ActualWorker = new Worker(url, opts);
}
@okikio
okikio / README.md
Last active June 25, 2021 20:35
Parallax Template
View README.md