Skip to content

Instantly share code, notes, and snippets.

View nathakits's full-sized avatar
💭
Brewing craft beer and growing mycelium

Nathakit Sae-Tan nathakits

💭
Brewing craft beer and growing mycelium
View GitHub Profile
@nathakits
nathakits / img-alt-tag.js
Last active January 15, 2020 03:51
Find image tags with no alt prop
const fs = require('fs');
const glob = require('glob');
const fileType = 'pages/**/*.vue';
const altString = /alt=/g;
const vImgString = /v-img|v-carousel-item/g;
function matchString(data, string) {
const alt = data.match(string);
if (alt) {
@nathakits
nathakits / merge.js
Created March 4, 2020 09:06
Merge 2 array objects
const arr1 = [{attributes: "foobar"}]
const arr2 = [{html: "foobar"}]
const mergedArray = arr1.map((item,i)=>{
//merging two objects
return Object.assign({},item,arr2[i])
})
// mergedArray = [{attributes: "foobar", html: "foobar}]
@nathakits
nathakits / docker.sh
Created August 31, 2020 08:57
Docker commands
# Remove dangling images
docker images -qf dangling=true | xargs docker rmi
@nathakits
nathakits / convert.sh
Created July 14, 2021 15:30
Convert mp4 to gif
ffmpeg -t 5 -i input.mp4 -vf -loop 0 output.gif
ffmpeg -ss 1 -t 5 -i input.mp4 -f gif output.gif
ffmpeg -ss 1 -t 4 -i input.mp4 -filter_complex "[0:v] fps=12,scale=720:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" output.gif