This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getFilterString = (chips = []) => { | |
const filterArray = chips.filter((item) => item.selected).map((item) => item.title); | |
let filter = ''; | |
filterArray.forEach((item, index) => { | |
filter += `${index === 0 ? '{' : ''}"tags":"${item}"${index === filterArray.length - 1 ? '}' : ','}`; | |
}); | |
return filter; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const checkInDayInterval = (dateFrom, dateTo, date = new Date()) => moment(date).isSame(dateFrom, 'day') || moment(date).isSame(dateTo, 'day'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)); | |
const asyncForEach = async (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array); | |
}; | |
}; | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"redux-ducks": { | |
"prefix": "rds", | |
"body": [ | |
"import {", | |
" put,", | |
" take,", | |
" select,", | |
" call,", | |
" all", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"react-functional-component": { | |
"prefix": "rfc", | |
"body": [ | |
"import React from 'react';", | |
"", | |
"function ${TM_FILENAME_BASE}({ ${2:propName} }) {", | |
" return (", | |
" <></>", | |
" );", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"react-class-component": { | |
"prefix": "rcc", | |
"body": [ | |
"import React, { Component } from 'react';", | |
"", | |
"class ${TM_FILENAME_BASE} extends Component {", | |
" render() {", | |
" const {", | |
" ${2:propsName}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Указываем box sizing */ | |
*, | |
*::before, | |
*::after { | |
box-sizing: border-box; | |
} | |
/* Убираем внутренние отступы */ | |
ul[class], | |
ol[class] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeFalsy(array = []) { | |
return array.filter(item => item) | |
} | |
console.log('====================================') | |
console.log(removeFalsy([null, undefined, false, 0, NaN, 1, 'a', true])) | |
console.log('====================================') | |
// ==================================== | |
// [1, "a", true] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import path from 'path'; | |
/** | |
* Чтение JSON | |
* @param {string} filepath - путь к файлу JSON | |
* @return {object} - весь JSON | |
*/ | |
export function getJSON(filepath = path.join(__dirname, '../../base', 'topics.json')) { | |
return JSON.parse(fs.readFileSync(filepath)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Alert } from 'react-native'; | |
import * as ImagePicker from 'expo-image-picker'; | |
import * as Permissions from 'expo-permissions'; | |
import * as ImageManipulator from 'expo-image-manipulator'; | |
export default class ImagePickerClass { | |
// хэндлер на onPress | |
pickPhoto = () => { |