Skip to content

Instantly share code, notes, and snippets.

View cozzin's full-sized avatar
🎯
Focusing

SeongHo Hong cozzin

🎯
Focusing
View GitHub Profile
@cozzin
cozzin / repeat_pod_update.sh
Created January 4, 2023 09:00
pod update every 1 min
for i in {1..60}; do pod update; date ; sleep 60; done
OutputStream outputStream = null;
try {
outputStream = exchange.getResponseBody();
outputStream.write(content.getBytes());
outputStream.flush();
} finally {
if (outputStream != null) {
outputStream.close();
}
}
OutputStream outputStream = exchange.getResponseBody();
outputStream.write(content.getBytes());
outputStream.flush();
outputStream.close();
@cozzin
cozzin / pr-comment.yml
Created May 23, 2022 10:46
pr comment bot
name: Pull request comment
on:
issue_comment:
types: [created, edited, deleted]
jobs:
pull_request_comment:
if: contains(github.event.comment.html_url, '/pull/') # check if the comments come from pull request, exclude those from issue.
runs-on: [macos-latest]
steps:
@available(iOS 13.0, *)
final class FixedSafeAreaInsetsHostingViewController<Content: SwiftUI.View>: UIHostingController<Content> {
override var prefersStatusBarHidden: Bool {
return false
}
override init(rootView: Content) {
super.init(rootView: rootView)
UIView.classInit
@cozzin
cozzin / Builder.swift
Last active May 26, 2021 06:24
Builder Pattern
protocol Builder {
func make(title: String)
func make(string: String)
func make(items: [String])
func close()
}
@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;
@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 / 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 / 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))