svn st | grep '^!' | awk '{print $2}' | xargs svn delete
svn st 했을때 나오는 수정리스트 중
! 로 시작하는 삭제한 파일들을 grep 으로 걸러주고
awk 로 경로부분만 추출하여
svn delete 명령어에 인자값으로 던져주는 방식
2014년 10월 30일 목요일
2014년 4월 13일 일요일
자바스크립트 압축하기
jquery 등을 받아보면 jquery-min-xxx 이런식으로 된 파일이 있다
열어보면
위처럼 보기 힘들게 한줄로 쭉 붙어나오는 자바스크립트가 나오는데
이런 파일을 만들어주는게 있다
http://yui.github.io/yuicompressor/
위 주소에서 받을 수 있고
bash 의 쉘 스크립트에서 압축할 스크립트들을 합쳐서 압축하는 스크립트를 만들어봤다
#!/bin/bash
target=""
if [ $# -lt 1 ]
then
target="./"
else
target=$1
fi
output='output.js'
str="grep -ril --exclude-dir=\.git //_compress_ $target"
scripts=`$str; 2>/dev/null`
merge=`mktemp -t merge.js`
for file in ${scripts[@]}; do
cat $file >> $merge
done
java -jar /usr/bin/yuicompressor.jar --type js "$merge" > "$output"
스크립트파일을 적당한곳에 저장한 뒤
인자값으로 경로를 넣어주면 해당 경로 하위의 파일들 중 //_compress_ 라는 문구가 들어있는 파일을 찾아서 하나의 자바스크립트 파일로 만들어준다
열어보면
이런 파일을 만들어주는게 있다
http://yui.github.io/yuicompressor/
위 주소에서 받을 수 있고
bash 의 쉘 스크립트에서 압축할 스크립트들을 합쳐서 압축하는 스크립트를 만들어봤다
#!/bin/bash
target=""
if [ $# -lt 1 ]
then
target="./"
else
target=$1
fi
output='output.js'
str="grep -ril --exclude-dir=\.git //_compress_ $target"
scripts=`$str; 2>/dev/null`
merge=`mktemp -t merge.js`
for file in ${scripts[@]}; do
cat $file >> $merge
done
java -jar /usr/bin/yuicompressor.jar --type js "$merge" > "$output"
스크립트파일을 적당한곳에 저장한 뒤
인자값으로 경로를 넣어주면 해당 경로 하위의 파일들 중 //_compress_ 라는 문구가 들어있는 파일을 찾아서 하나의 자바스크립트 파일로 만들어준다
2014년 3월 17일 월요일
NSString 을 hex 값으로 변환하기
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
위처럼 정의해놓고 UIColorFromRGB(0xabcdef) 이렇게 사용하는 경우가 많은데
NSString *color = @"abcdef";
요 color 를 0xabcdef 로 바꿔주는 코드다
unsigned colorInt = 0;
[[NSScanner scannerWithString:color] scanHexInt:&colorInt];
위처럼 실행해주고
UIColorFromRGB(colorInt)
끝
피드 구독하기:
덧글 (Atom)
