2016년 7월 15일 금요일

Python 삼항 연산자 | Python Ternary Operators

Case 1

result = 'True' if a > b else 'False'

Case 2

result = ('False', 'True')[a > b]

Case 3

result = (a > b) and 'True' or 'False'

Read More

2016년 7월 7일 목요일

Sass와 SCSS의 차이 | Difference Between Sass and SCSS

Sass

nav
  ul
    margin: 0
    padding: 0
    list-style: none

  li
    display: inline-block

  a
    display: block
    padding: 6px 12px
    text-decoration: none

SCSS

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    display: inline-block;
  }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}

Read More

핀터레스트 스타일 반응형 그리드 | Pinterest Style Responsive Grid

2016년 7월 6일 수요일

CSS div 세로 가운데 정렬 | CSS Vertical Middle for div

CSS

.container {
  display: table;
  height: 100%;
  position: absolute;
  overflow: hidden;
  width: 100%;
}
.helper {
  display: table-cell;
  vertical-align: middle;
}
.content {
  margin: 0 auto;
  width: 200px;
}

HTML

<div class="container">
  <div class="helper">
    <div class="content">TEXT</div>
  </div>
</div>

Read More

2016년 7월 5일 화요일

Linux에서 tar 압축 생성 및 해제 | Create and Extract tar in Linux

압축 생성 / 압축 하기 | Create

  • bar 디렉토리 압축 생성 | Create a new tar archive of the directory bar
tar -czf foo.tar.gz bar
  • a.txt 제외하고 bar 디렉토리 압축 생성 | Create a new tar archive of the directory bar excluding a.txt
tar -czf foo.tar.gz bar --exclude='a.txt'

압축 해제 / 압축 풀기 | Extract

  • 현재 디렉토리에 압축 해제 | Extract into current directory
tar -xzf foo.tar.gz
  • /home 디렉토리에 압축 해제 | Extract foo.tar.gz into /home directory
tar -xzf foo.tar.gz -C /home

Read More

CentOS 로그 로테이션 | Log Rotation on CentOS

Understanding logrotate on CentOS - part 1

Understanding logrotate on CentOS - part 2

Google 스프레드시트에 외부 JSON 데이터 입력 | Import External JSON data to Google Spreadsheet