본문 바로가기

[CodeIgniter] PHPUnit 적용 Test 파일에서 &get_instance()를 통해 객체를 받아온 후 사용해 주면 됨. 사용 예) class PostTest extends PHPUnit_Framework_TestCase{ private $CI; public function setUp(){ $this->CI = &get_instance(); $this->CI->load->database('testing'); } public function testGetsAllPosts() { $this->CI->load->model('post'); $posts = $this->CI->post->getAll(); $this->assertEquals(1, count($posts)); } } 이렇게 작성을 해주게되면 해당 CI에서 test를 해줄 수 있음... 더보기
[PHP] args 쉽게 처리하는 api 첨부된 파일을 include해준 후 사용해줄수 있음. 사용예 )]# [filename] -a [message_a] -b [message_b]이런식으로 사용하면 다음과 같이 사용할 수 있음. $arg = new Args(); if($flags['a'] = $arg->flag('a')){ $MESSAGE = $flags['m']; }else{ for($i = 5 ; $i flag('b')){ $ISSUE_ID = $flags['i']; } 위와같이 사용해 줄수 있음. 더보기
[LOC] 코드 라인수 구하는 프로그램 라인수 세는함수 사용방법cloc [exclude path] [project path] 더보기
[jQuery] .prependTo() .appendTo() .prependTo([element]) : element의 제일 위에 붙임 .appendTo([element]) : element의 제일 아래쪽에 붙임. 더보기
[Linux] 폴더내 파일 인코딩 바꾸기 # filename: euckr2utf8.sh # usage: ./euckr2utf8.sh source target # made by Heesung SHIN (ensual@gmail.com) # #!/bin/bash recurse () { rm -rf $2 echo make the directory $2 mkdir $2 for file in $(ls $1) do name="$1/$file" echo -n "$2/$file" | iconv -fcp949 -tutf8 -o temp # change the encoding of the name of file for newname in $(cat temp) do if [ -d $name ]; then recurse $name $newname else echo c.. 더보기