Skip to content

Instantly share code, notes, and snippets.

View melikhov-dev's full-sized avatar

Andrey Melikhov melikhov-dev

View GitHub Profile
const ADD_ITEM = 'ADD_ITEM'
function addItem (item) {
return {type: ADD_ITEM, payload: item}
}
function Items ({items, onClick}) {
return (
<div>
<ul>
{items.map((item) => <li>{item}</li>)}
</ul>
connect({
items: state`items`,
itemAdded: signal`itemAdded`
},
function Items ({items, itemAdded}) {
return (
<div>
<ul>
{items.map((item) => <li>{item}</li>)}
</ul>
const qsort = (arr) => {
if (arr.length < 2) {
return arr;
} else {
// Опорная точка для деления массива, выбирается случайно
const pivotPosition = Math.floor(Math.random() * arr.length);
const pivot = arr[pivotPosition];
// Значения меньшие, либо равные опорному
// попадают в новый массив less
const less = arr.filter((value, index) => {
const N = 10000;
let prev1, prev2, prev3, prev4;
let counter1 = 0, counter2 = 0, counter3 = 0, counter4 = 0;
function test(obj) {
if (!prev1) {
prev1 = obj;
}
if (!%HaveSameMap(prev1, obj)) {