Skip to content

Instantly share code, notes, and snippets.

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

Nathakit Sae-Tan nathakits

💭
Brewing craft beer
View GitHub Profile
@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
@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 / 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 / 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 / header-walker.js
Created January 13, 2020 05:47
Used to find matching header in vue files
const fs = require('fs');
const glob = require('glob');
const fileType = 'pages/**/*.vue';
glob(fileType, function (err, files) {
files.forEach(file => {
const data = fs.readFileSync(file, 'utf8');
const matchH1 = data.match(/h1/g);
if (matchH1) {
@nathakits
nathakits / polymer.md
Last active January 12, 2018 08:27
Polymer - notes and challenges

Polymer

Challenges

Testing

Testing Polymer components

Markdown

Markdown component performance on Polymer project

@nathakits
nathakits / ubuntu-powerline-install.md
Last active August 29, 2017 09:12
Powerline font install for Ubuntu 16.10 Raw

Install Powerline fonts Oh-My-Fish

If you're using Fish shell with OMF theme designed with Powerline fonts in mind, you'll need to install them on your machine. These are the most clear and cut-down instructions that I've found to work with Ubuntu 16.10 and all credit goes to petercossey's Ubuntu Powerline Install gist.

Get the font and config files

cd ~
@nathakits
nathakits / README.md
Last active June 28, 2017 03:15
NPM Cheatsheet
@nathakits
nathakits / git-alias.md
Last active December 25, 2018 04:15
Git command cheatsheet

Git Alias

Set an alias in git

git config --global alias.<command> "<git command>"

Example

@nathakits
nathakits / README.md
Created November 23, 2016 09:10
SVG Animation - animating along path

SVG Animation - animating along path

Community