This file contains 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 initStoryshots from '@storybook/addon-storyshots'; | |
import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer'; | |
import { puppeteerTest } from '@storybook/addon-storyshots-puppeteer'; | |
import { Page } from "puppeteer" | |
const path = require('path'); | |
const getCustomUrlParam = (param: string) => (url: string) => { | |
const regex = new RegExp(`^.+-custom-${param}-(\\d+).*$`) | |
const result = regex.exec(url) |
This file contains 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
ssh -vT -p <PORT> <HOST> |
This file contains 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
MakeFile: | |
export DOCKER_BUILDKIT=1 | |
build_visual_container: | |
docker build --ssh id=$$HOME/.ssh/id_rsa --file VisualTestingDockerfile -t visual . | |
VisualTestingDockerfile: | |
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan -p <?port> <host>.com >> ~/.ssh/known_hosts | |
RUN --mount=type=ssh,id=id --mount=type=ssh npm ci |
This file contains 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
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const fs = require('fs'); | |
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const path = require('path'); | |
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const en = require('../resources/en.json'); | |
function generateFromLangObj(lng, prefix = '') { | |
return Object.keys(lng) | |
.reduce((acc, key) => { |
This file contains 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
docker images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull |
This file contains 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
interface NestedArray<T> extends Array<T | NestedArray<T>> { } | |
function flatten(arr: NestedArray<number>) { | |
return arr.reduce((acc: number[], el) => { | |
if (Array.isArray(el)) { | |
return acc.concat(flatten(el)) | |
} | |
return acc.concat(el) | |
}, []) | |
} |
This file contains 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 createDateForDayNum(dayNum: number) { | |
const date = new Date(); | |
const day = date.getDay(); | |
const diff = date.getDate() - day + (day == 0 ? -6 : dayNum); | |
return new Date(date.setDate(diff)); | |
} |
This file contains 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 function subscribeWithSelector(selector: Function, cb: Function): Unsubscribe { | |
let prevValue = selector( | |
store.getState() | |
); | |
return store.subscribe(() => { | |
const newValue = selector( | |
store.getState() | |
); | |
if (newValue != prevValue) { | |
prevValue = newValue; |