Skip to content

Instantly share code, notes, and snippets.

View pxbuffer's full-sized avatar
🏠
Working from home

pxbuffer

🏠
Working from home
View GitHub Profile
@pxbuffer
pxbuffer / nbformat.json
Last active August 25, 2019 09:17
changes done!
{
"metadata": {
"kernel_info": {
"name": "effector-editor"
},
"language_info": {
"name": "ECMAScript",
"version": "6",
"mimetype": "application/javascript",
// @jsx el
// @jsxFrag 'Fragment'
import * as React from 'react'
import {catalogs} from './effects/fetch-data'
import {createStore, createEvent, createEffect, createApi} from 'effector'
import {useStore} from 'effector-react'
const root = document.getElementById('root')
function el(tag, props, ...children) {
@pxbuffer
pxbuffer / file1.txt
Created July 10, 2019 14:50
updated gist via ajax
updated String file contents via ajax
@pxbuffer
pxbuffer / file1.txt
Created July 10, 2019 14:50
updated gist via ajax
updated String file contents via ajax
/*
types:
simple - 2 persons
complex - 2 > persons
*/
const main = {
messages: {
title: 'Messages',
@pxbuffer
pxbuffer / fs.md
Last active August 22, 2019 19:33

+++ title = "Application structure" description = "Where to look for files and where to put new" date = 2019-08-20 rss = true +++

I split my source code on features/, ui/ and pages/.
Logic can be only in the pages/ and features/.

@pxbuffer
pxbuffer / env.js
Last active November 27, 2019 15:43
/* eslint-disable no-magic-numbers, unicorn/no-process-exit, no-console, prefer-template */
const fs = require('fs');
const path = require('path');
const dotenv = require('dotenv');
const dotenvExpand = require('dotenv-expand');
const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
// @flow
import { $baseUri } from "../model/config.store"
import { $token } from "../model/token"
type Method = "GET" | "POST" | "PUT" | "DELETE"
type Options = {
headers?: { [key: string]: string },
parse?: "text" | "json" | "noparse",
baseUri?: string,

Computation priority

For sure you've been noticed that function must be pure... or watch there is a place for side effect. Yes and we will tell about this in that section - Computation priority

A real example of queue priority - people awaiting medical treatment hospital, extreme emergency cases will have the highest priority and move on the start of the queue less significant at the end.

The main of the reason for creating Computation priority was that side effects:

  • Letting go first pure functions
  • Following consistent state of application
import {ChangeEvent, FocusEvent} from 'react'
import {
createEvent,
createEffect,
createStore,
forward,
combine,
guard,
sample,
Store,