Skip to content

Instantly share code, notes, and snippets.

View cinic's full-sized avatar

Alexandr Andreev cinic

View GitHub Profile
@AlexandrHoroshih
AlexandrHoroshih / bindings.ts
Last active April 24, 2024 05:13
effector + history
import { matchPath, RouteProps } from "react-router";
// historyUpdated event is subscribed to history via history.listen or any other way
export const createPathMatcher = <Match = unknown>(config: {
path: string | string[] | RouteProps;
clock?: Event<any> | Store<any> | Effect<any, any>;
}) => {
return sample({
source: historyUpdated,
@coltenkrauter
coltenkrauter / nginx.conf
Created January 23, 2021 21:36
Nginx configuration for SPAs (Single page applications) such as React or Angular
# https://www.zeolearn.com/magazine/setting-caching-headers-for-a-spa-in-nginx-cache
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options SAMEORIGIN;
function readCookies() {
const cookies = document.cookie.replaceAll("; ", "&");
const params = new URLSearchParams(cookies);
return Object.fromEntries(params.entries());
}
#!/bin/bash
#
# Inspects branch name and checks if it contains a Jira ticket number (i.e. ABC-123).
# If yes, commit message will be automatically prepended with [ABC-123].
#
# Useful for looking through git history and relating a commit or group of commits
# back to a user story.
#
@Tauka
Tauka / loose-coupling-effector.md
Last active November 22, 2019 09:59
Слабосвязные фичи в effector

Слабосвязные фичи в effector

Мотивация

Слабая связность и высокая переиспользуемость представлений + логики

Достоинства

  • Высокая переиспользуемость БЛ
    Несколько безсвязных фич, могут использовать внутри себя другую фичу со всеми ее вытекающими. Композиция фич на уровне effector
  • Абстракция БЛ
@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
@zerobias
zerobias / index.js
Created June 16, 2019 21:15
todolist for effector-react with hooks
import React from 'react'
import ReactDOM from 'react-dom'
import {createEvent, createStore, createApi, sample, combine} from 'effector'
import {useStore} from 'effector-react'
const inputStore = createStore('')
const todos = createStore([])
const visibilityFilter = createStore(todos => todos)
const submit = createEvent('sumbit form')
@popuguytheparrot
popuguytheparrot / useWS.js
Last active March 6, 2024 16:25
websocket hook with effector
import { useEffect, useRef, useCallback } from 'react';
import { createEvent, createStore } from 'effector';
import { useStore } from 'effector-react';
const open = createEvent('open');
const closed = createEvent('closed');
const error = createEvent('error');
const wsStatus = createStore('closed')
@bvaughn
bvaughn / index.md
Last active May 4, 2024 11:25
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

@nginx-gists
nginx-gists / api_backends.conf
Last active April 21, 2024 09:19 — forked from lcrilly/api_backends.conf
Deploying NGINX Plus as an API Gateway, Part 1
upstream warehouse_inventory {
zone inventory_service 64k;
server 10.0.0.1:80;
server 10.0.0.2:80;
server 10.0.0.3:80;
}
upstream warehouse_pricing {
zone pricing_service 64k;
server 10.0.0.7:80;