Skip to content

Instantly share code, notes, and snippets.

View dmitryshelomanov's full-sized avatar
🎯
Focusing

Shelomanov Dmitry dmitryshelomanov

🎯
Focusing
View GitHub Profile
const compose = (...funcs) =>
funcs.reduce((a, b) => (...args) => a(b(...args)), arg => arg)
@dmitryshelomanov
dmitryshelomanov / .js
Created December 11, 2017 08:19
curry
const getValue = (form, fieldName) => form[fieldName]
const form = {
firstName: 'dima',
lastName: 'shelomanov'
}
const curry = (fn, ...args) =>
(...currentArgs) => {
const allArgs = [...args, ...currentArgs]
@dmitryshelomanov
dmitryshelomanov / .js
Created December 11, 2017 10:21
react testing reducer
it.only('counter COUNTER_PLUS state', () => {
const store = global.mockStore(INITIAL_STATE)
const actions = store.dispatch(plus(1))
const testFn = counter(store.getState(), actions)
expect(testFn).toEqual({
number: 1
})
expect(store.getActions()[0]).toEqual({
type: types.COUNTER_PLUS,
payload: 1
const debug = require('debug')('banner:uploadBanner')
const fs = require('mz/fs')
const path = require('path')
const {
isZipFile,
notEmptyFile,
uuid,
decompress,
folderTree
} = require('../../helpers')
@dmitryshelomanov
dmitryshelomanov / .js
Created December 14, 2017 15:02
портянка
componentDidUpdate() {
if (this.cloneImage && this.originalWrap) {
this.originalImage = this.originalWrap.querySelector('img')
this.addEventListener()
this.clearStyles()
}
}
componentWillUnmount() {
this.removeListeners()
@dmitryshelomanov
dmitryshelomanov / .jsx
Last active December 20, 2017 11:28
Одиночный компонент
import React, { Component } from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import {
FlexWrap,
} from '../'
import { api } from '../../helpers/api'
class GifChangeContainer extends Component {
import React, { Component } from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import {
FlexWrap,
RangeVertical,
} from '../'
import { api } from '../../helpers/api'
@dmitryshelomanov
dmitryshelomanov / .js
Created December 25, 2017 16:39
test molecules
let props
let withInfo
let withoutInfo
beforeEach(() => {
withInfo = {
url: 'path_to_image',
info: {
percentCompress: 0,
},
import test from 'ava'
import { stub } from 'sinon'
import { Ctx } from '../../../../__TESTS__/koa-ctx'
import isZipFile from './is-zip-file'
/* eslint-disable prefer-destructuring */
/* eslint-disable no-param-reassign */
test.beforeEach((t) => {
t.context.ctx = new Ctx()
t.context.nextReturns = Math.random()
const debug = require('debug')('banner:update-color-bg')
const fs = require('fs-extra')
const cheerio = require('cheerio')
const {
tempPath,
folderExists,
} = require('../utils')
const data = function data(color) {
return `