Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mishelen on github.
  • I am mikhailhozhy (https://keybase.io/mikhailhozhy) on keybase.
  • I have a public key ASAIL8mzEusmbytMswbHDW0AlPeqiPReyenSqqL_OQBzsAo

To claim this, I am signing this object:

@mishelen
mishelen / partioningExecutor.js
Created November 16, 2018 14:21
Suppose you want to do complex calculations in JavaScript without blocking the Event Loop. You could partition your calculations so that each runs on the Event Loop but regularly yields (gives turns to) other pending events. In JavaScript it's easy to save the state of an ongoing task in a closure
function asyncExec(func, load, jobs) {
let done = false;
let value;
const makeDone = () => done = true;
return new Promise((resolve) => {
function executor(cb) {
if (!done) {
@mishelen
mishelen / git-tag-delete-local-and-remote.sh
Created May 20, 2018 09:12 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Input, FormFeedback, FormText } from 'reactstrap';
export const renderTextField = ({ input, meta: { touched, error, warning }, ...custom }) => (
<Fragment>
<Input {...(touched ? { valid: !error } : {})} {...input} {...custom} />
{error && <FormFeedback>{error}</FormFeedback>}
{!error && warning && <FormText>{warning}</FormText>}
</Fragment>
@mishelen
mishelen / tiktak.js
Created February 9, 2017 00:09
Node Test Task
const WebSocket = require('ws');
const ws = new WebSocket('ws://nuclear.t.javascript.ninja');
const coincidences = {};
const states = {};
const historyLimit = 5;
ws.on('open', () => console.log('Launched'));
ws.on('error', e => console.log(e));

Успел сделать только прототип плагина. С проблемами не столкнулся, просто не успел. Думаю их будет хватать. А пока уже практически познакомился с ES6.

.list-unstyled {
list-style: outside none none;
padding-left: 0;
}
#suggestions-block {
margin-top : 1em;
margin-bottom : 1em;
}
.suggestions {
class AutoComplete {
constructor(input, config) {
this.input = typeof input == "string" ? document.querySelector(input) : input;
this.wholeSuggestList = config.wholeSuggestList;
this.suggestListMathes = [];
this.options = Object.assign({
delay: 150,
suggestListClassName: 'suggestions list-unstyled',
maxSuggestions: 7,
minChars: 1
@mishelen
mishelen / ES6.sublime-build
Created March 31, 2016 21:38 — forked from therealklanni/ES6.sublime-build
ES6 REPL in Sublime Text
{
"cmd": ["/usr/local/bin/babel-node $file"],
"shell": true,
"selector": "*.js"
}
@mishelen
mishelen / destr.js
Created March 13, 2016 15:49
красивый пример деструктурирующего присваивания. Т.е. можно присваивать итерируемые объекты.
function* fibs() {
var a = 0;
var b = 1;
while (true) {
yield a;
[a, b] = [b, a + b];
}
}
var [first, second, third, fourth, fifth, sixth] = fibs();