Skip to content

Instantly share code, notes, and snippets.

View YuraKolesnikov's full-sized avatar

JurijsKolesnikovs YuraKolesnikov

  • Riga, Latvia
View GitHub Profile
@YuraKolesnikov
YuraKolesnikov / index.html
Created November 17, 2018 07:44
Flex slider/container
<div class="slider">
<div class="item item-1">
<span class="item-title">Summer</span></div>
<div class="item item-2">
<span class="item-title">Is</span></div>
<div class="item item-3">
<span class="item-title">Very</span></div>
<div class="item item-4">
<span class="item-title">Cool</span></div>
</div>
@YuraKolesnikov
YuraKolesnikov / css
Created November 17, 2018 12:38
Button shadow on hover correct animation
.button {
border-radius: 15px;
border-top-right-radius: 0px !important;
border-bottom-left-radius: 0px !important;
font-size: 24px;
color: white;
padding: 10px 15px;
border: none;
background-color: #1FDB84 !important;
cursor: pointer;
@YuraKolesnikov
YuraKolesnikov / CSS
Created November 17, 2018 12:41
Div animation on hover
/* Container styling */
.container {
position: relative;
width: 360px;
height: 640px;
margin-top: 150px;
background: rgba(0,0,0,0);
transform: rotate(-30deg) skew(25deg) scale(.8);
transition: all .5s ease;
}
const path = require('path');
module.exports = {
entry: './src/app.js',
output: {
path: path.resolve(__dirname, './public'),
filename: 'app.js',
publicPath: '/public'
},
module: {
@YuraKolesnikov
YuraKolesnikov / index.html
Created July 7, 2019 16:38
Select on change fetch
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<select name="category" id="category-select">
const array = [
{ name: 'Alfred', ranking: 3 },
{ name: 'Boris', ranking: 5 },
{ name: 'Chris', ranking: 2 },
{ name: 'Dylan', ranking: 1 },
{ name: 'Fitzgerald', ranking: 4 }
]
const sortByRanking = () => array.sort((a, b) => a.ranking > b.ranking)
@YuraKolesnikov
YuraKolesnikov / array.js
Created July 9, 2019 10:42
Working with array
const array = [
{ name: 'Alfred', ranking: 3 },
{ name: 'Boris', ranking: 5 },
{ name: 'Chris', ranking: 2 },
{ name: 'Dylan', ranking: 1 },
{ name: 'Fitzgerald', ranking: 4 }
]
const sortByRanking = () => array.sort((a, b) => a.ranking > b.ranking)
@YuraKolesnikov
YuraKolesnikov / TestPlugin.js
Created August 15, 2019 13:13
vuex-persistedstate performance in modular Vuex
import VuexPersistedState from 'vuex-persistedstate'
export const TestPlugin = VuexPersistedState({
key: 'test',
storage: window.localStorage,
paths: ['value']
})
/* Так как фильтр множественный, делаем так. Есть инпуты/селекты. На keydown.enter/change ебашим filterData.
Функция проверяет, есть ли такой фильтр уже в массиве, если нет, добавляет, если есть - проверяет, новое значение
пустое или нет. Если пустое - нахрен из массива, фильтр не нужен. Если не пустое - обновить значение. */
methods: {
async filterData({target}, id) {
const index = this.filters.findIndex(filter => filter.key == id)
const keyinFilters = this.filters[index]
if (keyinFilters) {
keyinFilters.value = target.value
if (keyinFilters.value == '') {
import axios from './axios';
export const CustomerApi = {
async getCustomers (query = null) {
return await axios.get('/customers?expand=orders', {
params: query
});
},
async createCustomer (payload) {
return await axios.post('/customers', payload);