Skip to content

Instantly share code, notes, and snippets.

Avatar
🤟
For peace!

YoonBong Kim y8k

🤟
For peace!
View GitHub Profile
@y8k
y8k / gitflow-breakdown.md
Created Jun 5, 2020 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@y8k
y8k / keybase.md
Created Jan 10, 2020
Keybase @ y8k
View keybase.md

Keybase proof

I hereby claim:

  • I am y8k on github.
  • I am y8k (https://keybase.io/y8k) on keybase.
  • I have a public key ASBXD3Qi21pe1oIVjQ76feIIDyJSE4wp9DJp1ccEumwORgo

To claim this, I am signing this object:

@y8k
y8k / DashedPhoneNumber.swift
Created Feb 1, 2018
Convert phone number consist of digits to with dash
View DashedPhoneNumber.swift
let phoneNumber = "01026979999"
// REGEX FOR KOREAN CELL PHONE NUMBER FORMAT
let expression = "(\\d{3})(\\d{\(phoneNumber.count - 7)})(\\d{4})"
let result = phoneNumber.replacingOccurrences(of: expression, with: "$1-$2-$3", options: .regularExpression, range: nil)
@y8k
y8k / UIViewAnimationOptions
Created Feb 26, 2016
Bitmask Example for Objective-C
View UIViewAnimationOptions
typedef NS_OPTIONS(NSUInteger, UIViewAnimationOptions) {
UIViewAnimationOptionLayoutSubviews = 1 << 0,
UIViewAnimationOptionAllowUserInteraction = 1 << 1, // turn on user interaction while animating
UIViewAnimationOptionBeginFromCurrentState = 1 << 2, // start all views from current value, not initial value
UIViewAnimationOptionRepeat = 1 << 3, // repeat animation indefinitely
UIViewAnimationOptionAutoreverse = 1 << 4, // if repeat, run animation back and forth
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5, // ignore nested duration
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6, // ignore nested curve
UIViewAnimationOptionAllowAnimatedContent = 1 << 7, // animate contents (applies to transitions only)
UIViewAnimationOptionShowHideTransitionViews = 1 << 8, // flip to/from hidden state instead of adding/removing
@y8k
y8k / gist:4671100490a738426443
Created Dec 18, 2015
For handling Universal Links
View gist:4671100490a738426443
func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
guard let rootViewCntrlr = self.window?.rootViewController else {
return false;
}
guard let viewCntrlr = rootViewCntrlr as? ViewController else {
return false;
}
@y8k
y8k / gist:8f98017f94a13a58d75a
Created Dec 18, 2015
apple-app-association example
View gist:8f98017f94a13a58d75a
{"applinks": {"apps": [], "details": [{ "appID": "[Team ID].com.y8k.UniversalLink", "paths":["*", "/"]}]}}
@y8k
y8k / gist:b691fb0964a8944cb495
Created Oct 27, 2015
Implementation Preview Actions for 3D touch
View gist:b691fb0964a8944cb495
override func previewActionItems() -> [UIPreviewActionItem] {
let safariAction = UIPreviewAction(title: "Open with Safari", style: UIPreviewActionStyle.Default) { (action, viewCntrlr) -> Void in
UIApplication.sharedApplication().openURL(NSURL(string: "http://y8k.me")!)
}
let closeAction = UIPreviewAction(title: "Copy URL", style: .Default) { (action, viewCntrlr) -> Void in
UIPasteboard.generalPasteboard().string = "http://y8k.me"
}
@y8k
y8k / gist:6c65d44f91d912147a5c
Created Oct 27, 2015
Implementation Pop for 3D Touch
View gist:6c65d44f91d912147a5c
func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {
showViewController(viewControllerToCommit, sender: self)
}
@y8k
y8k / gist:9e203413b10f16e9bd5b
Created Oct 27, 2015
Implementation Peek for 3D Touch
View gist:9e203413b10f16e9bd5b
func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = self.tableView.indexPathForRowAtPoint(location), cell = self.tableView.cellForRowAtIndexPath(indexPath) else { return nil }
let selectedData = self.data[indexPath.row]
var detailViewCntrlr: UIViewController?
switch selectedData.type {
case .List:
detailViewCntrlr = self.storyboard?.instantiateViewControllerWithIdentifier("DETAIL_LIST_SCREEN")
@y8k
y8k / gist:dd108513388f3188211c
Last active Oct 27, 2015
Register for 3D touch previewing.
View gist:dd108513388f3188211c
class PresentedViewController: UITableViewController, UIViewControllerPreviewingDelegate {
...
override func viewDidLoad() {
super.viewDidLoad()
registerForPreviewingWithDelegate(self, sourceView: view)
}