Skip to content

Instantly share code, notes, and snippets.

View cinic's full-sized avatar

Alexandr Andreev cinic

View GitHub Profile
@stakancheck
stakancheck / torrc
Last active September 21, 2024 08:03
torrc sample MacOS
ExcludeNodes {ru}, {by}, {ua}, {kz}
StrictNodes 1
GeoIPExcludeUnknown 1
ExitNodes {de}, {fr}, {fi}, {nl}, {nz}, {no}, {ch}, {se}, {dk}, {ee}
ClientTransportPlugin obfs4 exec /usr/local/bin/lyrebird managed
UseBridges 1
# Brides here
@palashmon
palashmon / Prettify.ts
Created May 13, 2023 16:11
A super useful type helper in TypeScript by Matt Pocock from Twitter
/**
* A TypeScript type alias called `Prettify`.
* It takes a type as its argument and returns a new type that has the same properties as the original type,
* but the properties are not intersected. This means that the new type is easier to read and understand.
*/
type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
@yyx990803
yyx990803 / repro.html
Created May 10, 2022 07:32
Weird detached element memory issue in Chrome
<div id="app">
<button id="reset">reset</button>
<button id="outer">no leak</button>
<div id="container">
<button id="inner">leak</button>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
@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')