Skip to content

Instantly share code, notes, and snippets.

View guest271314's full-sized avatar
💭
Fix WontFix

guest271314

💭
Fix WontFix
View GitHub Profile
@vitaly-t
vitaly-t / chain-arrays.ts
Last active October 2, 2024 13:45
Logically concatenates arrays
/**
* Iterable arrays chain, extended for "getLength" and "at" accessor.
*/
export interface IArraysChain<T> extends RelativeIndexable<T>, Iterable<T> {
/**
* Calculates total length of all input arrays combined.
*/
getLength(): number;
}
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[338],{578:(e,t,r)=>{e.exports=r.p+"7cf7ced34f0a1ece31b4.wasm"},338:(e,t,r)=>{var n;r.r(t),r.d(t,{default:()=>a});const a=(n="file:///private/tmp/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.mjs",function(e={}){var t,a,o=e;function i(e){e={log:e||function(){}};for(const t of i.za)t(e);return o.quickJSEmscriptenExtensions=e}o.ready=new Promise(((e,r)=>{t=e,a=r})),i.za=[],o.quickjsEmscriptenInit=i,i.za.push((e=>{e.getWasmMemory=function(){return Q}}));var _,u=Object.assign({},o),l="./this.program",s="object"==typeof window,f="function"==typeof importScripts,S="";(s||f)&&(f?S=self.location.href:"undefined"!=typeof document&&document.currentScript&&(S=document.currentScript.src),n&&(S=n),S=0!==S.indexOf("blob:")?S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):"",f&&(_=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}));var c,T=o.print||con
@jimmywarting
jimmywarting / cjs-in-esm.md
Last active January 27, 2024 18:02
using cjs in esm runtime (NodeJS)
@jordanbtucker
jordanbtucker / base64.js
Last active March 4, 2025 08:39
Base64
export function bytesToBase64(bytes) {
return btoa(String.fromCharCode(...bytes));
}
export function bytesToBase64URL(bytes) {
return bytesToBase64(bytes)
.replaceAll("+", "-")
.replaceAll("/", "_")
.replaceAll("=", "");
}
@voluntas
voluntas / h2c.go
Created August 22, 2023 00:55
HTTP/2 over TCP
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
@tghpereira
tghpereira / Readme.md
Last active March 8, 2025 17:43
Create native api websocket in nodejs (Experimental)

Create native websocket api in node js (Experimental)

Goal

Allow greater control of websockets in the api without relying on libs with socket.io and ws. Looking for the basic implementation of reading and writing data and connection handshake for projects where socket.io and ws do not support the required functionalities in the project.

Issues encountered

It is not possible to receive or send text messages longer than 65522 characters.

@yashraj1120
yashraj1120 / server.c
Created March 26, 2023 19:07
simple response server
// webserver.c
// https://bruinsslot.jp/post/simple-http-webserver-in-c/
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/socket.h>
@mamannn
mamannn / http2.js
Created March 15, 2023 14:45
http2
import got from "got";
import http2 from "http2-wrapper";
const httpsProxy = new http2.proxies.Http2OverHttp({
proxyOptions: {
url: "http://localhost:3128",
// For demo purposes only!
rejectUnauthorized: false,
},
@Ustice
Ustice / Boolean Algebra for Programmers in a Nutshell.md
Last active October 29, 2024 05:00
Boolean Algebra in a nutshell for JS/TS programmers

Boolean Algebra in a nutshell for JS/TS programmers

There are a lot of strategies that you will hear about in the Javascript community for keeping your conditionals from becoming a tangled mess. This isn't like them. This is someting different. MATH! Boolean Algebra to be exact. I use it all the time to simplify complex conditionals. There are two things that you need to know: de Morgan's Theorem, and Karnaugh (pronounced CAR-no) Maps. (Don't worry, there is no test)

de Morgan's Theorem

De Morgan's Theorem is great distributing nots (!), and for when you want to convert an && to an ||, or back. This is it:

 !(A &amp;&amp; B) = !A || !B
@lukaslihotzki
lukaslihotzki / polyfill_worklet_import.js
Last active October 1, 2022 14:02
Polyfill to support "import" in worklet scripts in Firefox
const wrappedFunc = Worklet.prototype.addModule;
Worklet.prototype.addModule = async function(url) {
try {
return await wrappedFunc.call(this, url);
} catch (e) {
if (e.name != 'AbortError') {
throw e;
}
// assume error is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1572644