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 / ViewControllerBasedOnKeyboard.h
Last active January 11, 2017 07:41
change view based on keyboard height
@property CGFloat currentKeyboardHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *btnBottomConstraint;
@cozzin
cozzin / BarcodeGenerator.java
Last active March 21, 2017 02:13
Using ZXing library in Android Studio
package com.dotincorp.android.util;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.AsyncTask;
import android.util.Log;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
@cozzin
cozzin / appDelegate.m
Created January 29, 2018 04:34
iOS Local Push
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
// push received
}
@cozzin
cozzin / AddProjectToGithub
Last active March 11, 2018 12:18
Adding an existing project to GitHub using the command line
git init
git add .
git commit -m "First commit"
git remote add origin 원격_저장소_URL
git remote -v
git push -u origin master
@cozzin
cozzin / ProtocolGetAndSet.swift
Created March 15, 2018 07:11
Undetstanding about getter and setter of protocol
// https://teamtreehouse.com/community/i-dont-understand-get-and-get-set
protocol TestProtocol {
var testVar: Int { get }
}
class TestClass: TestProtocol {
var testVar: Int = 0
}
@cozzin
cozzin / DispatchQueueUtil.swift
Last active March 16, 2018 05:43
async with completion
extension DispatchQueue {
public func async(execute work: @escaping () -> Void, complete: @escaping () -> Void) {
async(execute: [work], complete: complete)
}
public func async(execute works: [() -> Void], complete: @escaping () -> Void) {
let dispatchGroup = DispatchGroup()
works.forEach { work in
async(group: dispatchGroup) {
work()
@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
extension UITableView {
func reloadDataAndKeepOffset() {
let offset = contentOffset
reloadData()
layoutIfNeeded()
setContentOffset(offset, animated: false)
}
}
@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)
}
func formatByteCount(bytes: Int64) -> String {
let byteCountFormatter = ByteCountFormatter()
return byteCountFormatter.string(fromByteCount: bytes)
}