Skip to content

Instantly share code, notes, and snippets.

View zerobias's full-sized avatar
💭
Set your status

Dmitry zerobias

💭
Set your status
View GitHub Profile
function Lock () {
var next = typeof setImmediate === 'undefined' ? setTimeout : setImmediate
var locked = {}
function _releaser (key, exec) {
return function (done) {
return function () {
_release(key, exec)
@zerobias
zerobias / nicknames.md
Last active June 16, 2022 07:44
nicknames
16.06.2022
Дима Zerobias
01.03.2022
⛴➡️🍆
@zerobias
zerobias / scroll to top.js
Created July 22, 2018 14:21
Scroll to top component
import { Component } from 'react';
import { withRouter } from 'react-router';
class ScrollToTop extends Component {
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) {
window.scrollTo(0, 0);
}
}
render() {
@zerobias
zerobias / async component.js
Last active November 16, 2018 20:21
Async component
import React, { Component } from "react";
export default function asyncComponent(importComponent) {
class AsyncComponent extends Component {
constructor(props) {
super(props);
this.state = {
component: null
};
@zerobias
zerobias / interval-tree-1d.js
Last active July 20, 2018 01:00
interval-tree-1d with preval
//@noflow
/* eslint-disable */
'use strict';
//prettier-ignore
(function () {
var $$0 = {
enumerable: false,
configurable: false
};
@zerobias
zerobias / a-source.re
Created July 8, 2018 18:20
Prepack + reason compilation
type idInt = int;
type countInt = int;
let nextId = {
let id: ref(idInt) = ref(0);
(.) => {
id := id^ + 1;
id^;
type graph_term('a) = {
nodes: list('a),
edges: list(('a, 'a)),
};
let example_graph = {
nodes: ['b', 'c', 'd', 'f', 'g', 'h', 'k'],
edges: [('h', 'g'), ('k', 'f'), ('f', 'b'), ('f', 'c'), ('c', 'b')],
};
@zerobias
zerobias / effector-terminal.js
Created June 22, 2018 08:33
Full-width terminal monitor for multiply parallel tests
//@flow
import {
createEvent,
createStore,
combine,
type Event,
type Store,
} from 'effector'
//@flow
class Foo<Properties: Object> {
$key: $Keys<Properties> | 'c';
$value: $Values<Properties>;
}
//@flow
export type ExtractReturn<Fn> = $Call<<T>((...Iterable<any>) => T) => T, Fn>;
//example
const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: {
setCompany: ({ companyId, domainName }) =>
dispatch(