Skip to content

Instantly share code, notes, and snippets.

View yarastqt's full-sized avatar
⚛️
Hello from the dark side

Eugene Tropin yarastqt

⚛️
Hello from the dark side
View GitHub Profile
@yarastqt
yarastqt / react-router-effector-bind.ts
Created January 31, 2024 10:10 — forked from den-churbanov/react-router-effector-bind.ts
Effector bindings for react-router-dom v.6.2.1
import { useContext } from 'react';
import { createStore, createEffect, createEvent, sample, attach, combine, restore } from 'effector';
import { spread, debug, not, and, empty, or } from 'patronum';
import { createGate, useGate } from 'effector-react';
import {
useLocation,
useNavigate,
matchPath,
generatePath,
RouteMatch,
import { resolve } from 'path'
import sequence from 'run-sequence'
import dotenv from 'dotenv'
import sort from 'sort-stream'
/* Common */
import gulp, { src, dest } from 'gulp'
import changed from 'gulp-changed'
import when from 'gulp-if'
import sourcemaps from 'gulp-sourcemaps'
import plumber from 'gulp-plumber'
export class Semaphore {
private concurrency: number
private currentCount: number
private queue: (() => void)[]
constructor(concurrency: number) {
this.concurrency = concurrency
this.currentCount = 0
this.queue = []
}
import pydicom
import os
def split_multiframe_dicom(input_file):
ds = pydicom.dcmread(input_file)
number_of_frames = int(ds.NumberOfFrames)
pixelArray = ds.pixel_array.squeeze()
for idx in range(number_of_frames):
file_meta = pydicom.dataset.FileMetaDataset()
import { FC, createContext, useContext } from 'react';
export function createModelFactory<T extends (...args: any[]) => any>(creator: T) {
type Model = ReturnType<typeof creator>;
type ModelProps = { model: Model };
const Context = createContext<Model | null>(null);
function useModel() {
const model = useContext(Context);
{
"config": {
"specification": {
"languageCode": "ru-RU",
"audioEncoding": "MP3"
}
},
"audio": {
"uri": "https://storage.yandexcloud.net/yarastqt-media/record.mp3"
}
@yarastqt
yarastqt / x.ts
Created February 16, 2022 16:33
class SharedStore {
hydrate(ctx) {
this.data = ctx.data
}
}
const $sharedStore = new SharedStore()
class FeatureStore {
data = $sharedStore.data
import { declare } from '@babel/helper-plugin-utils'
import { types as t } from '@babel/core'
import type {
ImportDeclaration,
TaggedTemplateExpression,
Program,
CallExpression,
} from '@babel/types'
import type { NodePath } from '@babel/core'

Темизация

Надо подумать про то, чтобы сократить количество переменных, допустим у нас есть несколько уровней:

  1. Глобальный
  2. Компонентный

Есть следующая структура: