Skip to content

Instantly share code, notes, and snippets.

View y8k's full-sized avatar
🤟
For peace!

YoonBong Kim y8k

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

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 January 10, 2020 09:27
Keybase @ y8k

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 February 1, 2018 14:25
Convert phone number consist of digits to with dash
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 February 26, 2016 14:09
Bitmask Example for Objective-C
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 December 18, 2015 05:40
For handling Universal Links
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 December 18, 2015 05:05
apple-app-association example
{"applinks": {"apps": [], "details": [{ "appID": "[Team ID].com.y8k.UniversalLink", "paths":["*", "/"]}]}}
@y8k
y8k / gist:b691fb0964a8944cb495
Created October 27, 2015 05:27
Implementation Preview Actions for 3D touch
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 October 27, 2015 05:13
Implementation Pop for 3D Touch
func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {
showViewController(viewControllerToCommit, sender: self)
}
@y8k
y8k / gist:9e203413b10f16e9bd5b
Created October 27, 2015 05:06
Implementation Peek for 3D Touch
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 October 27, 2015 02:54
Register for 3D touch previewing.
class PresentedViewController: UITableViewController, UIViewControllerPreviewingDelegate {
...
override func viewDidLoad() {
super.viewDidLoad()
registerForPreviewingWithDelegate(self, sourceView: view)
}