Skip to content

Instantly share code, notes, and snippets.

View sergiycheck's full-sized avatar
🏠
Working from home

Serhii sergiycheck

🏠
Working from home
View GitHub Profile
@sergiycheck
sergiycheck / users-messages-join.js
Created March 31, 2023 22:00
join with lookup tables on js
const messages = [
{
id: 1,
text: 'text 1',
userId: 1
},
{
id: 2,
text: 'text 2',
userId: 1
@sergiycheck
sergiycheck / cust-dynamic-redis-cache.module.ts
Created July 2, 2022 10:33
nest js redis cache dynamic global module
import { CacheModule, Global, Module } from '@nestjs/common';
import type { ClientOpts } from 'redis';
import { ConfigModule, ConfigService } from '@nestjs/config';
import redisStore from 'cache-manager-redis-store';
@Global()
@Module({
imports: [
CacheModule.registerAsync<ClientOpts>({
imports: [ConfigModule],
@sergiycheck
sergiycheck / photoPreview.tsx
Created May 23, 2022 12:04
photo preview component with react, chakra and FileReader
export const PhotoPreviewExcerpt = ({
file,
setSelectedFiles,
}: {
file: File;
setSelectedFiles: React.Dispatch<React.SetStateAction<File[] | null | undefined>>;
}) => {
const fileReaderRef = React.useRef<FileReader>();
const [photoSrc, setPhotoSrc] = React.useState<string>();
code --install-extension analytic-signal.preview-mp4
code --install-extension Angular.ng-template
code --install-extension apollographql.vscode-apollo
code --install-extension bungcip.better-toml
code --install-extension dbaeumer.vscode-eslint
code --install-extension dsznajder.es7-react-js-snippets
code --install-extension eamodio.gitlens
code --install-extension ecmel.vscode-html-css
code --install-extension esbenp.prettier-vscode
code --install-extension formulahendry.auto-rename-tag
@sergiycheck
sergiycheck / js
Created November 11, 2021 14:22
find num in string
function findNumInString(str) {
const arrMatches = str.match(/\d+/g);
const num = Number(arrMatches[0]);
return num ? num : 0;
}
@sergiycheck
sergiycheck / js
Last active November 11, 2021 14:22
traverse child elements dom
function traverseChildren(elem, tagname) {
if (elem.tagName === tagname) cl(elem, elem.tagName);
if (!elem.children.length) return;
Array.from(elem.children).forEach((child) => {
traverseChildren(child);
});
}