Quasar의 모든 글
RasterizeHTML
일반 HTML 블록을 캔버스에 그려서 텍스쳐화 해주는 모듈
위는 사용 예제
HTMLElement 최대화/최소화
three.js 를 이용하여 3D 뷰어를 만들다 보면 화면을 가득 차게하여 크게 렌더링 해야할 때가 생긴다. 그렇게 하기 위해서는 requestFullscreen 이라는 함수를 이용 하면 간단하게 화면 채우기를 할 수 있다.
if ( document.fullscreenElement ) {
htmlElement.requestFullscreen(); // 해당 element의 함수를 호출하여 fullscreen 요청 한다.
} else if ( document.exitFullscreen ) {
document.exitFullscreen(); // 닫을 때에는 글로벌 인스턴스인 document로 요청 한다.
}
- iframe 형태로 불러왔을 경우 해당 요소의 allow=”fullscreen” 속성을 지정해주면 외부에서도 최대화/최소화를 실행 할 수 있다. 속성을 설정하지 않으면 다음과 같은 메세지를 볼 수 있다.
706ea4b.js:1 Uncaught (in promise) TypeError: Disallowed by permissions policy
at HTMLDivElement.<anonymous> (706ea4b.js:1:463616)
구글 시트 활용 정리
수모 제작 발송 하는데 구글시트 활용이 어마어마한걸 체험했다.
활용 범위가 엄청 넓다. 업무 자동화도 조금만 코드 만들면 다 될듯…
주소로 우편번호 출력할 수 있는 함수 만들기
Taking over console.log
웹 개발할 때 html / javascript 의 console 명령어들을 오버라이드 해서 사용자화를 시도해보았다.
아래는 구글 검색으로 찾아낸 정보들 이다.
아직 구현은 완성하지 못했다.
https://tobyho.com/2012/07/27/taking-over-console-log/
https://stackoverflow.com/questions/49541173/how-to-prevent-default-handling-of-touch-events
아이폰 터치 먹통일때 재부팅
스마트폰 사이드 볼륨 버튼 위/아래를 순서대로 누른후
전원 버튼을 스마트폰이 꺼질때까지 계속 누르고 있으면 재시동 된다.
버전 관리 git hook 스크립트
git push 또는 commit 실행 전에 특정 파일(버전 정보가 등록되어있는 파일)의 문자열을 자동으로 치환하여 반영 할 수 있도록 shell 스크립트를 작성해 보았다.
이 스크립트로 특정 명령어를 commit 메세지에 포함 할 경우 버전 넘버를 수정 하도록 하면 되겠다. 매개변수를 받아서 처리 할 수 있다면 더 좋을 것 같다.
최종 스크립트
#!/bin/sh
#echo "commit githooks"
path="./src/version/current.js"
# ver-major / ver-minor / ver-patch / ver-hotfix
tokens=('MAJOR' 'MINOR' 'PATCH' 'REVISION')
#cat .git/COMMITMESSAGE
#versionTok=`grep -oP '(?<=#)(\s)(.*$)' ".git/COMMITMESSAGE"`
versionTok=`grep -oP '[?<=#]\w+' .git/COMMITMESSAGE`
# echo "$versionTok"
# check=`grep 'major' ".git/COMMITMESSAGE"`
# if [ -z "$check" ]
# then
# echo "empty"
# else
# echo "not empty"
# fi
echo "$versionTok"
substr='#major'
token="${tokens[0]}"
if [[ "$versionTok" =~ "$substr" ]]
then
# match
major=`grep -oP "(?<=$token=)\w+" $path`
_major=$(($major+1))
echo "$token : $major >> $_major"
grep -rl "$token" $path|xargs sed -i "s/$major/$_major/g"
fi
substr='#minor'
token="${tokens[1]}"
if [[ "$versionTok" =~ "$substr" ]]
then
# match
major=`grep -oP "(?<=$token=)\w+" $path`
_major=$(($major+1))
echo "$token : $major >> $_major"
grep -rl "$token" $path|xargs sed -i "s/$major/$_major/g"
fi
substr='#patch'
token="${tokens[2]}"
if [[ "$versionTok" =~ "$substr" ]]
then
major=`grep -oP "(?<=$token=)\w+" $path`
_major=$(($major+1))
echo "$token : $major >> $_major"
grep -rl "$token" $path|xargs sed -i "s/$major/$_major/g"
fi
#value=`cat $path`
#echo "$value"
#file=$(<./src/version/current.js)
#echo "$file"
# add changes to commit state
git add ./src/version/current.js
exit 0
---[pre-commit]---
#!/bin/sh
#echo "hello githooks"
path="./src/version/current.js"
tokens=('MAJOR' 'MINOR' 'PATCH' 'REVISION')
major=`grep -oP "(?<=${tokens[0]}=)\w+" $path`
minor=`grep -oP "(?<=${tokens[1]}=)\w+" $path`
patch=`grep -oP "(?<=${tokens[2]}=)\w+" $path`
_major=$(($major+10))
_minor=$(($minor+5))
_patch=$(($patch+100))
echo "${tokens[0]} : $major >> $_major"
echo "${tokens[1]} : $minor >> $_minor"
echo "${tokens[2]} : $patch >> $_patch"
grep -rl "${tokens[0]}" $path|xargs sed -i "s/$major/$_major/g"
grep -rl "${tokens[1]}" $path|xargs sed -i "s/$minor/$_minor/g"
grep -rl "${tokens[2]}" $path|xargs sed -i "s/$patch/$_patch/g"
#value=`cat $path`
#echo "$value"
#file=$(<./src/version/current.js)
#echo "$file"
exit 1
--- [./src/version/current.js] ---
const MAJOR=173
const MINOR=173
const PATCH=333



#!/bin/sh
#echo "commit githooks"
#특정 문자열 입력시만 작동하는 분기 로직
path="./src/version/current.js"
tokens=('MAJOR' 'MINOR' 'PATCH' 'REVISION')
# ver-major / ver-minor / ver-patch / ver-hotfix
#cat .git/COMMITMESSAGE
#versionTok=`grep -oP '(?<=#)(\s)(.*$)' ".git/COMMITMESSAGE"`
versionTok=`grep -oP '[?<=#]\w+' .git/COMMITMESSAGE`
# echo "$versionTok"
# check=`grep 'major' ".git/COMMITMESSAGE"`
# if [ -z "$check" ]
# then
# echo "empty"
# else
# echo "not empty"
# fi
echo "$versionTok"
substr='#major'
if [[ "$versionTok" =~ "$substr" ]]
then
#echo "match"
else
#echo "not match"
fi
substr='#minor'
if [[ "$versionTok" =~ "$substr" ]]
then
#echo "match"
else
#echo "not match"
fi
substr='#patch'
if [[ "$versionTok" =~ "$substr" ]]
then
#echo "match"
else
#echo "not match"
fi
#value=`cat $path`
#echo "$value"
#file=$(<./src/version/current.js)
#echo "$file"
# add changes to commit state
git add ./src/version/current.js
exit 1
리눅스 bash 스크립트 기능 찾을 때 참고한 사이트들
연산자 사용법
https://www.geeksforgeeks.org/bash-script-arithmetic-operators/
배열 사용법
https://shlee1990.tistory.com/918
문자열 치환 (sed)
https://askubuntu.com/questions/76808/how-do-i-use-variables-in-a-sed-command
특정 파일의 특정 문자열 치환 (grep | sed)
https://unix.stackexchange.com/questions/472476/grep-global-find-replace
https://www.hahwul.com/2019/02/10/multi-file-replace-string-with-grep-sed/
쉘 기본 사용 법
https://engineer-mole.tistory.com/200
깃 훅 예제
Gram-Schmidt process
임의의 벡터 세트가 서로 직교 하도록 하는 계산 법


