Skip to content

Instantly share code, notes, and snippets.

View zarabotaet's full-sized avatar
☄️
flying on the comet🌚

Dmitrij Shuleshov zarabotaet

☄️
flying on the comet🌚
  • ringcentral.com
  • Ukraine
View GitHub Profile
test('stuff', async () => {
// форкаем домен, создаем новый независимый скоуп
const scope = fork(root, {
// в конфиге форка будут модификации, которые применятся к скоупу
values: new Map()
.set($myStore, value), // подменили стартовое значение стора эксклюзивно для этого скоупа
handlers: new Map()
.set(myFx, mockHandler) // подменили хэндлер эффекта эксклюзивно для этого скоупа
});
@mattitanskane
mattitanskane / hidedock.md
Last active January 22, 2024 12:53
How to hide the Dock on MacOS

I never use the Dock and all it does for me is come in the way when I'm resizing windows or clicking on stuff I can't access using just my keyboard.

Here's a way to hide the Dock so it doesn't get in the way anymore.

Run the following commands in the terminal.

# Hide Dock
defaults write com.apple.dock autohide -bool true && killall Dock
defaults write com.apple.dock autohide-delay -float 1000 && killall Dock
@doasync
doasync / request.js
Last active May 29, 2020 10:39
Axios-like fetch
const queryString = (params) => {
const qs = String(new URLSearchParams(params));
return qs ? `?${qs}` : "";
};
const joinBase = (url, baseUrl) =>
`${baseUrl.replace(/\/$/, "")}/${url.replace(/^\/|\/$/, "")}/`;
const contentTypeJson = { "Content-Type": "application/json" };
@laughinghan
laughinghan / Every possible TypeScript type.md
Last active March 31, 2024 04:40
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@zerobias
zerobias / h.ts
Last active April 18, 2022 08:23
Declarative stack-based DOM api
import {
createStore,
createEvent,
is,
clearNode,
forward,
sample,
Store,
Event,
launch