Skip to content

Instantly share code, notes, and snippets.

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

Egor egorguscha

🏠
Working from home
View GitHub Profile
cast call 0xC4d46B52fc6370e2e4C503792571d643205Ff71B "endGame(bytes32,bytes,(address,uint256)[])" 0xf9ced70f805158b0ef94d452e26ab8b0cc38cca6431ff3e758f6c243fc4f161c 0xde70a909bec139c71d89dfe24c39c0e38771ff397ff4f66f3d6409dbf614416b4532d702429bb61a1b5d042fbedd65fdf520afa93ae44634255e84829fdff1721b '[{"player":"0xEf52e9B1E48fEE631E987b9CB92a0340d418507e","score":"18063000000000000000000"},{"player":"0xeb9A816E0C9ae9c410ea543d4d3a5413510e7360","score":"15216000000000000000000"},{"player":"0x8e3CfcdF7992301B1219B213631956863e08Bf2A","score":"5263000000000000000000"},{"player":"0x3e3048DD1F9877c977E99e44FA4e66cE80dEA9B6","score":"4461000000000000000000"},{"player":"0x4703521a4246078Ec9519Cd4e725Ff6318f51AAd","score":"4453000000000000000000"},{"player":"0xf0d9aa462B14915208FA2Ca4e4Cd57400DdB2B96","score":"3624000000000000000000"},{"player":"0xEefa6ED822D5B1F344b99f756DA600F0074dFaE7","score":"3416000000000000000000"},{"player":"0x654E798099ff4960031d817a21F13e55Da9fA089","score":"2739000000000000000000"},{"player":
@egorguscha
egorguscha / fo.js
Last active November 20, 2020 17:56
#!/usr/bin/env node
console.log(123)
import { I18nTypes } from './I18nTypes';
const lang = 'en';
interface Langs {
[key: string]: string | string[];
}
/*tslint:disable:no-var-requires*/
const langs: Langs = require(`./langs/${lang}.json`);
const setInitialState = (settings) => {
const {
itemHeight,
amount,
tolerance,
minIndex,
maxIndex,
startIndex
} = settings;
const viewportHeight = amount * itemHeight;
import React, {useEffect, useState} from 'react'
import {FixedSizeList} from 'react-window'
import {Table} from 'antd';
// https://jsonplaceholder.typicode.com/posts?_page=1&_limit=10
import 'antd/dist/antd.css'
const columns = [
{
title: 'User ID',
function css(tags, ...attrs) {
const value = style(tags, ...attrs)
const node = document.createElement('style')
node.id = 'insertedStyle'
node.appendChild(document.createTextNode(value))
const sheet = document.getElementById('insertedStyle')
if (sheet) {
sheet.disabled = true
sheet.parentNode.removeChild(sheet)
}
import {ChangeEvent, FocusEvent} from 'react'
import {
createEvent,
createEffect,
createStore,
forward,
combine,
guard,
sample,
Store,

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
// @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,
@egorguscha
egorguscha / 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')];