Skip to content

Instantly share code, notes, and snippets.

View Y-Taras's full-sized avatar
🏠
Working from home

Taras Yaremkiv Y-Taras

🏠
Working from home
  • Ukraine, Ivano-Frankivsk
View GitHub Profile
import React from 'react'
import { NavLink as RRNavLink, Link } from 'react-router-dom'
import {
Collapse,
Navbar,
NavbarToggler,
NavbarBrand,
Nav,
NavItem,
NavLink
import React from "react";
import PropTypes from 'prop-types'
import {Card, CardImg, CardBlock, CardTitle, CardText, Button} from 'reactstrap';
const ProductCard = ({elem, cartIds, quantity, addItemToCart, history}) => (
<Card className="m-1" style={{width: '18rem'}}
onClick={() => {
history.push(`/products/${elem.id}`)
}}>
/* eslint no-console: 0 */
import React, {Component} from "react";
import PropTypes from 'prop-types'
import {connect} from 'react-redux';
import {
Card, Button, CardImg, CardTitle, CardText,
CardBlock, Row, Col, Input, InputGroup, InputGroupAddon
} from 'reactstrap';
import InputRange from 'react-input-range';
import axios from 'axios';
import { SET_FILTER_TERM, SET_FILTER_PRICE, ADD_API_DATA } from './actions';
export function setFilterTerm(filterTerm) {
return { type: SET_FILTER_TERM, payload: filterTerm };
}
export function setFilterPrice(filterPrice) {
return { type: SET_FILTER_PRICE, payload: filterPrice };
}
/* eslint no-console: 0 */
import React, {Component} from "react";
import PropTypes from 'prop-types'
import {connect} from 'react-redux';
import {
Card, Button, CardImg, CardTitle, CardText,
CardBlock, Row, Col, InputGroup, InputGroupAddon
} from 'reactstrap';
import InputRange from 'react-input-range';
<CardDeck>
array.slice(0, 3).map(function mapProductCards(elem, index) {
return (
<Card className="m-1" style={{width: '18rem'}} key={elem.id}>
<CardImg top width="100%" src={`/public/img/${elem.image}`} />
<CardBlock>
<CardTitle>{elem.name}</CardTitle>
<CardText>{elem.price}</CardText>
<CardText>isAvailable</CardText>
<CardText>{elem.manufacturer}</CardText>
/* eslint no-console: 0 */
import React, {Component} from "react";
import PropTypes from 'prop-types'
import {connect} from 'react-redux';
import {
Card, Button, CardImg, CardTitle, CardText,
CardBlock, Row, Col, InputGroup, InputGroupAddon
} from 'reactstrap';
import {setFilterTerm, getAPIDetails} from '../redux/actionCreators';
import React, { PropTypes } from 'react';
import { Route, Redirect } from 'react-router-dom';
const Authenticated = ({ loggingIn, authenticated, component, ...rest }) => (
<Route {...rest} render={(props) => {
if (loggingIn) return <div></div>;
return authenticated ?
(React.createElement(component, { ...props, loggingIn, authenticated })) :
(<Redirect to="/login" />);
}} />
@Y-Taras
Y-Taras / MiniMax proto
Last active September 20, 2016 20:21
changed version
var board = ['x', 'o', 'e', 'e', 'o', 'e', 'e', 'e', 'e'];
var signPlayer = 'o';
var signAI = (signPlayer === 'x') ? 'o' : 'x';
game = {
over: function(board) {
for (var i = 0; i < board.length; i += 3) {
if (board[i] === board[i + 1] && board[i + 1] === board[i + 2]) {
return board[i] !== 'e' ? board[i] : false;
}
var inputItem = 'o';
var board = [null , null , null , null , 'o', null , null , null , null ];
var sign = {
max: inputItem === "o" ? "x" : "o",
min: inputItem === "x" ? "x" : "o"
};
function generateTable(board, sign) {
var testBoard = [],
nextBoard;