Skip to content

Instantly share code, notes, and snippets.

View cozzin's full-sized avatar
🎯
Focusing

SeongHo Hong cozzin

🎯
Focusing
View GitHub Profile
@objc protocol AAA {
}
extension AAA {
var aa: Int {
return 0
}
}
//
// SideMenuViewController.swift
// sieum
//
// Created by 홍성호 on 2018. 6. 26..
// Copyright © 2018년 홍성호. All rights reserved.
//
import UIKit
import SnapKit
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"
@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
//
@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
}
//: Playground - noun: a place where people can play
import UIKit
class TestClass {
deinit {
print("deinit \(self)")
}
@cozzin
cozzin / CachedClassifier.swift
Last active October 12, 2018 02:28
Swift Memoization
class CachedClassifier {
private var sumCache = [Int: Int]()
func sumOfFactors(_ number: Int) -> Int {
if let cachedValue = sumCache[number] {
return cachedValue
}
let sum = aliquotSum(factors(number))
@cozzin
cozzin / gitignore 기준으로 다시 트래킹 하기
Last active August 16, 2020 07:55
[Git] gitignore 기준으로 다시 트래킹 하기
git rm -r --cached .
git add .
git commit -am 'refresh git tracking'
git push
@cozzin
cozzin / UserAgentFetcher.swift
Created September 24, 2020 02:22
Using WKWebview to get userAgent synchronously
public final class UserAgentFetcher: NSObject {
private let webView: WKWebView = WKWebView(frame: .zero)
@objc
public func fetch() -> String {
dispatchPrecondition(condition: .onQueue(.main))
var result: String?
@cozzin
cozzin / IteratorExample.java
Created January 6, 2021 01:07
ReactiveStreams
import java.util.Iterator;
public class IteratorExample {
public static void main(String[] args) {
Iterable<Integer> iterable = () -> new Iterator() {
int i = 0;
final static int MAX = 10;
public boolean hasNext() {
return i < MAX;