Skip to content

Instantly share code, notes, and snippets.

View alexgriss's full-sized avatar

Aleksandr Grigorenko alexgriss

  • Saint-Petersburg, Russia
View GitHub Profile
@alexgriss
alexgriss / LineChart.jsx
Last active March 21, 2019 23:38
LineChart.jsx
import React from 'react'
const STROKE_COLOR = '#ff0000'
const STROKE_WIDTH = 1
/**
* data: number[]
* chartHeight: number
* chartWidth: number
*/
/**
*
* Fills duplicates in array with given value, returns a new array.
*
* ([1, 1, 1, 2, 2, 3, 3, 3,], null) => [1, null, null, 2, null, 3, null, null]
*
*/
export const fillArrayDuplicatesWithValue = (array, value) => {
let newArray = []
let uniqueItem
@alexgriss
alexgriss / pollingSagasHelpers.js
Last active December 24, 2018 12:07
Polling saga helpers
import { delay } from 'redux-saga'
import { call, take, race } from 'redux-saga/effects'
export const generatePollingWorkerSaga = ({
internalSuccessSaga,
internalFailureSaga,
pollingDelay,
}) =>
function*(action) {
while (true) {