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 MinWindowSubstringWithoutDuplicate([N, K]) { | |
| const matcher = N.split("").reduce((acc, char, idx) => { | |
| if (acc.size === new Set(K).size) { | |
| return acc; | |
| } | |
| for (const Kchar of K) { | |
| if (char === Kchar) { | |
| acc.set(char, idx) | |
| break; |
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 { configure } from '@storybook/react'; | |
| import '../src/index.css'; // custom styles for storybook layout | |
| const req = require.context('../src', true, /\.stories\.tsx$/); // all *.stories.tsx files | |
| // import files | |
| function loadStories() { | |
| req.keys().forEach(filename => req(filename)); | |
| } |
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
| FROM node:lts-alpine as builder | |
| RUN apk add --no-cache bash | |
| WORKDIR /usr/src/app | |
| COPY . . | |
| ENV NODE_ENV=production | |
| RUN npm i -g yarn | |
| RUN \ | |
| yarn install --frozen-lockfile --production; \ | |
| yarn build |
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
| FROM nginx:alpine | |
| ENV API_ENDPOINT=http://localhost/api/v1 | |
| ENV APP_VERSION=v1.0.0 | |
| RUN /bin/sh -c "envsubst '\${API_ENDPOINT} \${APP_VERSION}' < /etc/nginx/conf.d/default.tmpl > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' " |
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
| Yup.object().shape({ | |
| password: Yup.string().required('Password is required'), | |
| passwordConfirm: Yup.mixed().test('match', 'Passwords do not match', function (password) { | |
| return password === this.parent.passwordConfirm | |
| }).required('Password confirm is required') | |
| }) |
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 fn = (a, b, c) => [a,b,c]; | |
| const fnWithDefault = (a, b = 'default arg', c) => [a,b,c]; | |
| R.curry(fn)(1); // fn(b) => fn(c) => [1,b,c] | |
| R.curry(fnWithDefault)(1); // [1, 'default arg', undefined] |
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
| FROM node:carbon as builder | |
| WORKDIR /usr/src/app | |
| COPY . . | |
| ENV NODE_ENV production | |
| RUN npm i && npm run build | |
| FROM nginx:1.15.2 | |
| WORKDIR /usr/src/app | |
| ENV API_ENDPOINT https://api.com | |
| COPY --from=builder /usr/src/app/build . |
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
| exec("cwebp -m 6 -preset icon -mt -af " + source_file + " -o " + file.dest + ".webp"); | |
| if( fs.statSync(file.dest)["size"] < fs.statSync(file.dest + ".webp")["size"]){ | |
| exec("cwebp -m 6 -preset picture -mt -af " + source_file + " -o " + file.dest + ".webp"); | |
| if( fs.statSync(file.dest)["size"] < fs.statSync(file.dest + ".webp")["size"]){ | |
| exec("cwebp -m 6 -lossless -mt " + file.dest + " -o " + file.dest + ".webp"); | |
| } | |
| } |
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 CreditCardNumber (props) => { | |
| let formatter = (event) => { | |
| let val = event.target.value; | |
| let newVal = ''; | |
| val.replace(/([0-9]{0,4})/g, function(str){ | |
| newVal += str.length === 4 ? str+' ' : str; | |
| }); | |
| event.target.value = newVal.replace(/(\s$)/g, '').slice(0,19); | |
| }; | |
| return <input type="text" onChange="formatter" placeholder="0000 0000 0000 0000" {...props}>; |
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
| // | |
| // Requirements | |
| // | |
| var gulp = require('gulp'), | |
| _if = require('gulp-if'), | |
| path = require('path'), | |
| argv = require('yargs').argv, | |
| clean = require('gulp-clean'), | |
| filter = require('gulp-filter'), | |
| rename = require('gulp-rename'), |
NewerOlder