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
| // convert mov to gif | |
| ffmpeg -i video.mov -vf palettegen palette.png | |
| ffmpeg -i video.mov -i palette.png -lavfi paletteuse=bayer_scale=4:dither=bayer -r 18 -s 320x399 video.gif | |
| // crop gif | |
| // https://stackoverflow.com/a/14036766/863110 | |
| convert input.gif -coalesce -repage 0x0 -crop WxH+X+Y +repage output.gif |
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 { DefinePlugin } = require('webpack'); | |
| module.exports = { | |
| entry: './src/components/main.tsx', | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.ts|.tsx?$/, | |
| use: 'ts-loader', | |
| exclude: /node_modules/ |
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
| var Ajv = require('ajv'); | |
| var ajv = new Ajv(); | |
| var validate = ajv.compile(schema); | |
| var valid = validate(data); | |
| if (!valid) console.log(validate.errors); |
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
| { | |
| "fullname": "your full name" | |
| } |
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 users from './users.json'; | |
| const shema = { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "fullname": { | |
| "type": "string", | |
| "minLength": 2 |
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
| it.only(`should user's schema be valid`, () => { | |
| const schema = { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "fullname": { | |
| "type": "string", | |
| "minLength": 2 | |
| }, |
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
| expect.extend({ | |
| toBeValid(isValid, errorMessage) { | |
| return { | |
| message: () => isValid ? '' : errorMessage, | |
| pass: isValid | |
| } | |
| } | |
| }); | |
| it(`should user's schema be valid`, () => { |
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 validateSecuredUrl = function (schema, uri) { | |
| return uri.indexOf('https://') === 0; | |
| }; | |
| ajv.addKeyword('securedUrl', { | |
| validate: validateSecuredUrl, | |
| errors: true | |
| }); | |
| it(`should user's schema be valid`, () => { |
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 validateSecuredUrl = function (schema, uri) { | |
| validateSecuredUrl.errors = [{keyword: 'secured', message: 'avatar url must be "https" schema', params: {keyword: 'secured'}}]; | |
| return uri.indexOf('https://') === 0; | |
| }; | |
| ajv.addKeyword('securedUrl', { | |
| validate: validateSecuredUrl, | |
| errors: true | |
| }); |