Skip to content

Instantly share code, notes, and snippets.

View olecksamdr's full-sized avatar

Oleksandr olecksamdr

View GitHub Profile
@olecksamdr
olecksamdr / RadioButton.jsx
Created October 24, 2018 06:05
Radio button which looks like button
import React from 'react';
import { string } from 'prop-types';
import styled from 'styled-components';
import { getThemeColor } from 'utils/theme';
const Label = styled.label`
padding: 12px 20px;
display:block;
cursor: pointer;
@olecksamdr
olecksamdr / PinInput.jsx
Created October 23, 2018 07:37
Pin Input Component
import React, { PureComponent } from 'react';
import { number, func, bool } from 'prop-types';
import { PinItem } from './style';
const BACKSPACE_KEY = 8;
const LEFT_ARROW_KEY = 37;
const UP_ARROW_KEY = 38;
const RIGHT_ARROW_KEY = 39;
const DOWN_ARROW_KEY = 40;
@olecksamdr
olecksamdr / SelectComp.jsx
Created October 23, 2018 06:39
Select component
import React from 'react';
import styled from 'styled-components';
import { func, string, bool, shape, arrayOf } from 'prop-types';
import { ErrorMessage } from 'components/global/ErrorMessage';
import { SpinnerSvg } from 'components/global/Spinner';
import { Translation } from 'shame/translations';
import InfiniteOptions from './InfiniteOptions';
import {
import { string } from 'prop-types';
import { compose, setPropTypes, withHandlers } from 'recompose';
import animate from 'utils/animate';
import { ScrollDownButton } from './style';
const enhancer = compose(
setPropTypes({
elementId: string.isRequired,
const handleScroll = ({ target }) => {
if (target.scrollTop + target.clientHeight >= target.scrollHeight) {
// loadMoreData();
}
};
element.addEventListener('scroll', handleScroll)
const withClickOutside = ({
refHandlerName = 'registerRef',
clickHandlerName = 'onClick',
onClickOutside = () => {},
}) => WrappedComponent =>
class ClickOutside extends Component {
constructor(props) {
super(props);
this.open = false;
@olecksamdr
olecksamdr / const-media.js
Last active October 16, 2018 16:50
A HOC which receive media query string, and hide wrapped component when this window size matches this media query
export const SIZES = {
small: 768,
medium: 1024,
large: 1200,
};
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace numbersTogather_2
{
class Program
{
static int getAB(int a, int b)
@olecksamdr
olecksamdr / ac.cs
Last active October 27, 2016 21:32
// Необхідність стиску зображень
//C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace arithmeticCompession
{
// 2.2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;