Skip to content

Instantly share code, notes, and snippets.

View kettanaito's full-sized avatar
🚀
Working on EpicWeb.dev

Artem Zakharchenko kettanaito

🚀
Working on EpicWeb.dev
View GitHub Profile
@kettanaito
kettanaito / pipeline-stream.ts
Created October 26, 2024 17:32
PipelineStream
export class PipelineStream extends TransformStream {
constructor(
transformStreams: Array<TransformStream>,
...strategies: Array<QueuingStrategy>
) {
super({}, ...strategies)
const readable = [super.readable as any, ...transformStreams].reduce(
(readable, transform) => readable.pipeThrough(transform)
)
@kettanaito
kettanaito / readme.md
Last active January 8, 2024 03:14
A Proper Package Registry for JavaScript

A Proper Package Registry for JavaScript

Historically, NPM has had a number of issues that affected the entire ecosystem one way or the other. I tend to believe most of those issues arise from the fundamental design flaws of NPM and are not as easily solved.

In this document, I propose an alternative to the NPM registry. Let's call it a "Proper Package Registry", or PPR for short. This alternative aimes to solve the long-standing issues with NPM, such as name squatting, package unpublishing, versioning, as well as add a few points concerning developer experience, which is close to non-existing when using NPM as a package author.

Package validation

PPR ships with a CLI that offers extensive tools to validate the package you are about to publish. This is completely missing from NPM and has been in the top of my painpoints list for all the years I've been publishing packages.

@kettanaito
kettanaito / mocking-websockets.md
Last active November 12, 2023 10:43
On Mocking Websockets

On Mocking WebSockets

Unlike HTTP, WebSocket communication is duplex (both the client and the server can emit and listen to events) and persistent. This difference is reflected in how one would expect to mock a WebSocket communication.

Connection

I believe mocking WebSockets should be connection-based. This way each individual connected client is scoped to a particular interceptor handler.

interceptor.on('connection', (connection) =&gt; {
@kettanaito
kettanaito / yieldMany.js
Created August 18, 2023 09:53
Yield Promise.race()
async function* yieldMany(promises) {
promises.forEach((p) => {
return p.then((value) => {
promises.splice(
promises.findIndex((xp) => xp === p),
1
);
return value;
});
});
@kettanaito
kettanaito / quest.md
Last active July 9, 2023 18:19
World_SecretCellar.qst in Human Language

World_SecretCellar Quest Description

Hi, folks. I haven’t found a human-friendly representation of what’s going on in json/base/meta/Quest/World_SecretCellar.qst.json so I spend an hour writing one up. Below is what’s described in the quest file, some of my assumptions, and a few clear things from the data I’ve not seen mentioned yet.

The quest has 3 phases:

Phase 1

When the objective is set (quest is taken):

  1. Callback 1. A quest message is displayed (associated with the WORLD_SECRETCELLAR_STATUES_ACTIVATED enum). This is not a condition so this is a side-effect (arEventFilters) and not a player requirement.
  2. Callback 2. This one has multiple sub-callbacks.
@kettanaito
kettanaito / rtk-esm-ts-notes-2023-02-27.md
Created May 12, 2023 13:49 — forked from markerikson/rtk-esm-ts-notes-2023-02-27.md
RTK ESM/TS Config meeting notes - 2023-02-27/28

RTK ESM/TS Discussion

Attendees:

  • Nathan Bierema
  • Mateusz Burzynski
  • Mark Erikson

Notes

  • Mateusz: what do you want besides "ship widely compat code?" What preferences?
// TODO: make `pages` optional and measure the div when unspecified, this will
// allow more normal document flow and make it easier to do both mobile and
// desktop.
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
@kettanaito
kettanaito / README.md
Last active November 15, 2024 15:46
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@kettanaito
kettanaito / INSTALL.md
Last active January 31, 2022 01:36
Source private beta

Beta Program

Thank you for deciding to participate in the closed beta of our new library called "Source"! Through your feedback we will be able to refine it, making the lives of thousands of developers easier.

What is this library about?

The Source library allows you to generate request handlers from various sources. Currently, we support only HTTP archives (HAR) and OpenAPI (Swagger).

What do you expect from me?

@kettanaito
kettanaito / apollo.d.ts
Created November 5, 2021 00:26
Annotate context type from "@apollo/client"
declare module '@apollo/client/core' {
export interface DefaultContext {
accessToken: string
}
}
export {}