Skip to content

Instantly share code, notes, and snippets.

View cozzin's full-sized avatar
🎯
Focusing

SeongHo Hong cozzin

🎯
Focusing
View GitHub Profile
//: Playground - noun: a place where people can play
import UIKit
class TestClass {
deinit {
print("deinit \(self)")
}
@cozzin
cozzin / HeaderFooterViewHeight.swift
Last active August 9, 2018 07:36
여러 UI 컴포넌트들이 있는 HeaderView의 높이 계산해주기
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
guard let headerView = headerView(at: section) else {
return nil
}
return headerView.systemLayoutSizeFitting(CGSize(width: targetView.frame.width, height: CGFloat.greatestFiniteMagnitude), withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel).height
}
@cozzin
cozzin / Emptiable+Extension.swift
Created August 8, 2018 14:40
check isNotEmpty isNotNilNotEmpty
//
// Emptiable+Extension.swift
// sieum
//
// Created by 홍성호 on 2018. 8. 8..
// Copyright © 2018년 홍성호. All rights reserved.
//
// https://github.com/artsy/Emergence/blob/master/Emergence/Extensions/Apple/Occupyable%2BisNotEmpty.swift
//
Pod::Spec.new do |s|
s.name = "SHSideMenu"
s.version = "0.0.4"
s.summary = "Simple side menu view controller 🍔"
s.description = <<-DESC
Simple side menu view controller for ios 🍔
DESC
s.homepage = "https://github.com/cozzin/SHSideMenu"
s.license = "MIT"
//
// SideMenuViewController.swift
// sieum
//
// Created by 홍성호 on 2018. 6. 26..
// Copyright © 2018년 홍성호. All rights reserved.
//
import UIKit
import SnapKit
@objc protocol AAA {
}
extension AAA {
var aa: Int {
return 0
}
}
func formatByteCount(bytes: Int64) -> String {
let byteCountFormatter = ByteCountFormatter()
return byteCountFormatter.string(fromByteCount: bytes)
}
@cozzin
cozzin / RxTableView.swift
Last active August 19, 2018 14:44
How to cache height values ​​through delegate when using rxdatasoruce
class ViewController: UIViewController {
private var cellHeightsDictionary: [String: CGFloat] = [:]
override func viewDidLoad() {
super.viewDidLoad()
// set table view ...
tableView.rx.setDelegate(self).disposed(by: disposeBag)
}
extension UITableView {
func reloadDataAndKeepOffset() {
let offset = contentOffset
reloadData()
layoutIfNeeded()
setContentOffset(offset, animated: false)
}
}
@cozzin
cozzin / setting python on centOS7
Last active April 1, 2018 09:20
python 기본 세팅하기
# https://janikarhunen.fi/how-to-install-python-3-6-1-on-centos-7.html
# Install the necessary utilities
sudo yum update
sudo yum install yum-utils
sudo yum groupinstall development
sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
sudo yum install python36u
sudo yum install python36u-pip