fmpeg -f image2 -framerate 2 -i %2d.jpg out.gifffmpeg -f image2 -framerate 2 -i %2d.jpg -pix_fmt yuv420p -crf 17 -vcodec libx264 out.mp4| const originalError = console.error | |
| beforeAll(() => { | |
| jest.spyOn(console, 'error').mockImplementation((...args) => { | |
| if ( | |
| typeof args[0] === 'string' && | |
| args[0].includes('inside a test was not wrapped in act') | |
| ) { | |
| return | |
| } |
| export const mockLocation = value => | |
| Object.defineProperties(window, { | |
| location: { | |
| value, | |
| writable: true, | |
| }, | |
| }) | |
| export const mockPathname = pathname => | |
| mockLocation({ |
| import { dirname } from 'path' | |
| import { fileURLToPath } from 'url' | |
| export const getDirname = (importMetaUrl) => | |
| dirname(fileURLToPath(importMetaUrl)) | |
| // use as `getDirname(import.meta.url)` |
| { | |
| "scripts": { | |
| "test": "node ./path-to/test-runner.mjs" | |
| } | |
| } |
| #! /bin/bash | |
| find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + |
| #!/bin/bash | |
| function wav2mp3() { | |
| for filename in *.wav; do | |
| echo wav2mp3: converting $filename | |
| mp3_filename="${filename[@]/%wav/mp3}" | |
| lame --preset insane "$filename" "$mp3_filename" | |
| echo wav2mp3: finished converting $filename | |
| echo | |
| done |
| const { spawn } = require('child_process') | |
| const chokidar = require('chokidar') | |
| const chalk = require('chalk') | |
| const paths = ['./src/main.js'] | |
| let child | |
| let wait = false | |
| spawnElectron() |
| const rotate = (array, n) => [ | |
| ...array.slice(array.length - n), | |
| ...array.slice(0, array.length - n), | |
| ] |
| export function isEventWithin(e, element) { | |
| const rect = element.getBoundingClientRect() | |
| return ( | |
| rect.top <= e.clientY && | |
| e.clientY <= rect.top + rect.height && | |
| rect.left <= e.clientX && | |
| e.clientX <= rect.left + rect.width | |
| ) | |
| } |