Skip to content

Instantly share code, notes, and snippets.

@ilyalesik
ilyalesik / array.js
Last active November 27, 2017 09:31
Input array
[
{
id: 1,
content: "Полностью не согласен с автором",
username: "alex23",
},
{
id: 2,
content: "Ты просто ничего не понимаешь!!!",
username: "dead_mouse",
@ilyalesik
ilyalesik / result.html
Last active December 1, 2017 20:40
Result
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<ul>
<li>Полностью не согласен с автором
<ul>
<li>Ты просто ничего не понимаешь!!!
import { todoRequest } from "./api"
function* todoRequestWorker() {
try {
const result = yield call(todoRequest);
yield put({type: "FETCH_TODO_SUCCESS", value: result});
return result;
} catch (e) {
yield put({type: "FETCH_TODO_ERROR", e});
}
function* fetchTodoWorker() {
yield put({type: "FETCH_TODO_REQUEST"});
const { value } = yield take("FETCH_TODO_SUCCESS");
}
// @flow
type AsideFilterProps<V: {[string]: {| name: string|}}, T: {[string]: {| name: string, group: $Keys<V>|}}> = {
groups: V,
checkboxes: T,
values: {[$Keys<T>]: boolean}
};
function f<V, T>(props: AsideFilterProps<V, T>): void {}
f({
const renameKey = (object, key, newKey) => {
const {[key]: k, ...omitObject} = object;
return {...omitObject, [newKey]: object[key]}
};
const Doctor = (props) => {
const [opened, setOpened] = useState(false);
return <div>
{props.expandable && <Arrow onClick={() => setOpened(!opened)} />}
</div>
}
const ExpandableDetector = (props) => {
@ilyalesik
ilyalesik / reshadow.js
Last active May 11, 2019 19:11
Reshadow syntax propsal
import React from "react";
import styled from "reshadow";
const css = styled`
button {
width: 250px;
}
span[size='l'] {
text-transform: uppercase;
}
@ilyalesik
ilyalesik / effector.md
Created August 13, 2019 17:45
Article "Why I choose Effector instead of Redux or MobX?"

Effector is a brand new reactive state manager. He has an ambitious team that aims to make a state manager who solves all the problems of existing solutions. Writing the core of the library took six months and several attempts when the team started development from scratch. They recently released the first stable release 19.0.0.

At this article, I will show why I prefer using Effector for new projects instead of other state managers. Let's started from Effector API.

Stores and events

Effector use two intuitive concepts: store and event.

A store is an object that holds some value. We can create stores with createStore method:

@ilyalesik
ilyalesik / text.js
Created December 5, 2019 10:38
Figma samples
// Creating text with zero width and wrapping any symbols to the next line
const textNode = figma.createText();
textNode.textAutoResize = 'HEIGHT';
textNode.characters = "some text";