Skip to content

Instantly share code, notes, and snippets.

View hoyangtsai's full-sized avatar
⌨️
Prompting

Hoyang Tsai hoyangtsai

⌨️
Prompting
View GitHub Profile
@hoyangtsai
hoyangtsai / format.sh
Last active December 27, 2021 07:02
#ffmpeg #videoConvert #command
# convert to h.264 mp4
ffmpeg -i $input -f mp4 -vcodec libx264 -preset fast -profile:v high -level:v 5 $output -hide_banner
3 remove audio track only
ffmpeg -i $input -vcodec copy -an $output
# shrink video resolution
ffmpeg -i input.mp4 -vf scale=480:320 output_320.mp4
# change the video resolution and aspect ratio
@hoyangtsai
hoyangtsai / Adobe
Last active December 9, 2020 06:37
hosts
# Adobe
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
@hoyangtsai
hoyangtsai / utils.numberToDay.js
Last active March 27, 2022 09:47 — forked from niksumeiko/utils.numberToDay.js
#JavaScript function that converts a number into the #2-digits day of the month with leading zeros (01-31)
/**
* Turns a number/string to 2 digits day of the month with leading zero.
* @param {number|string} day to turn into day.
* @return {string}
*/
function numberToDay(j) {
return ('0' + j).slice(-2);
}
// Examples:
@hoyangtsai
hoyangtsai / iPhoneX.css
Created November 27, 2018 04:52
IPhone X, Xs Max and XR media query
/* iPhone X and Xs Max */
@media only screen
and (min-device-width: 375px)
and (min-device-height: 812px)
and (-webkit-device-pixel-ratio: 3)
and (orientation: portrait) {
/* styles */
}
/* iPhone XR */
@hoyangtsai
hoyangtsai / short.sh
Last active January 8, 2022 01:23
github url #shorten #snippet
curl -i https://git.io -F "url=<original_url>" [-F "code=<token>"]
: '
$ curl -i https://git.io -F "url=https://gist.github.com/hoyangtsai/a6f2cddb1de1a25c42e030ab8d9ee559"
HTTP/1.1 201 Created
Status: 201 Created
Content-Type: text/html;charset=utf-8
Location: https://git.io/JSbdz
...
@hoyangtsai
hoyangtsai / gulpfile.js
Created June 1, 2019 16:57
postcss project boilerplate
const {task, src, dest ,watch, series, parallel} = require('gulp');
const rename = require('gulp-rename');
const postcss = require('gulp-postcss');
const prettify = require('gulp-jsbeautifier');
const connect = require('gulp-connect');
const postcssConfig = require('./postcss.config.js');
const cssOutput = './css';
const postcssWatchFiles = ['./pcss/**/[^_]*.pcss', '!node_modules/**'];
@hoyangtsai
hoyangtsai / extend.js
Last active April 11, 2020 10:13
full screen class
fullScreenClass() {
const w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
const h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
const ratio = +(h / w);
@hoyangtsai
hoyangtsai / gulpfile.js
Created November 11, 2019 11:03
split js function into each markdown
const jsdoc2md = require('jsdoc-to-markdown')
const gulp = require('gulp')
const glob = require('glob')
const path = require('path')
const fs = require('fs-extra')
const docDir = './docs'
async function doJsdoc2md() {
const fileSrc = 'src/**/*.js';
@hoyangtsai
hoyangtsai / number.js
Created November 13, 2019 07:43
check a char is number between 0 and 9
let charCode = String.prototype.charCodeAt.call(str, index)
// char code between 48 and 57 is the number 0 - 9
if ( charCode < 48 || charCode > 57) {
...
}
@hoyangtsai
hoyangtsai / git.sh
Last active March 26, 2020 02:19
git spare-checkout clone subdirectory
# create a directory for the project repo
mkdir [project_name] && cd [project_name]
# initialize git repo
git init
# enable git subtree checkout
git config core.sparsecheckout true
# enter a folder name which is checked out