Skip to content

Instantly share code, notes, and snippets.

View e-sung's full-sized avatar

류성두 e-sung

View GitHub Profile
@e-sung
e-sung / delete_branches_older_than.sh
Last active March 2, 2022 05:44 — forked from njames/delete_branches_older_than.sh
Script to delete branches older than 6 months old, ignore local vs remote errors.
#!/bin/sh
ECHO='echo '
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -wv 'main\|develop\|master\|release'); do
if ! ( [[ -f "$branch" ]] || [[ -d "$branch" ]] ) && [[ "$(git log $branch --since "3 month ago" | wc -l)" -eq 0 ]]; then
if [[ "$DRY_RUN" = "false" ]]; then
ECHO=""
fi
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
echo "Deleting: " + $local_branch_name
const { exec } = require('child_process');
let authorName = "e-sung" // 여기만 각자 깃헙 아이디로 수정!!
exec('gh pr list --json "reviews,title,author" --limit 100', (err, stdout, stderr) => {
if (err) {
console.error(err)
} else if (stderr) {
console.error(stderr)
} else {
let PRs = JSON.parse(stdout)
@e-sung
e-sung / DogStatView.swift
Created August 22, 2021 04:23
Delivering an Exceptional Accessibility Experience 의 샘플코드를 LayoutDrivenUI기반으로 재작성함
class DogStatsView: UIView {
@IBOutlet var nameTitleLabel: UILabel!
@IBOutlet var nameLabel: UILabel!
@IBOutlet var breedTitleLabel: UILabel!
@IBOutlet var breedLabel: UILabel!
@IBOutlet var ageTitleLabel: UILabel!
@IBOutlet var ageLabel: UILabel!
@IBOutlet var weightTitleLabel: UILabel!
@IBOutlet var weightLabel: UILabel!
@e-sung
e-sung / checkPodFileDiff.sh
Created August 4, 2021 05:47
Pod Install 해야 하는지
#!/bin/zsh
diff "Podfile.lock" "Pods/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
echo "Pod Install 해야 합니다"
else
echo "Pod Install 안해도 됩니다"
fi
import UIKit
@IBDesignable public class DesignableView: UIView {
@IBInspectable public var borderColor: UIColor = UIColor.clear {
didSet {
layer.borderColor = borderColor.cgColor
}
}
import UIKit
import SwiftUI
import Foundation
import PlaygroundSupport
/// 터치 포인트와 원의 중심과의 거리만큼 원이 늘어나도록 하는 뷰
struct ResizableCircle: View {
@State var circleRadius:CGFloat = 100
/// 하드코딩된 값을 쓰지 않고, 그냥, View자체의 center 의 CGPoint값을 알아 낼 수 있는 방법이 없을까요?
var center: CGPoint = CGPoint(x: 200, y: 200)
@e-sung
e-sung / CircularProgressView.swift
Last active September 17, 2022 02:20
ProgressBar that has circular form with gradient
@IBDesignable
public class CircularProgressView: UIView {
@IBInspectable public var progress: Float = 0 {
didSet {
drawProgress()
}
}
public var lineWidth: CGFloat = 4 {
didSet {
@e-sung
e-sung / HandOffable.swift
Created January 19, 2020 02:06
Protocol that enables basic HandOff feature
public protocol HandOffable {
func setUpHandOff(for url: URL?)
}
extension HandOffable where Self: UIViewController {
public func setUpHandOff(for url: URL?) {
guard let url = url else { return }
guard let activtiyType = Bundle.main.bundleIdentifier else { return }
userActivity = NSUserActivity(activityType: activtiyType)
userActivity?.isEligibleForHandoff = true
@e-sung
e-sung / XibGenerated.swift
Created January 18, 2020 14:36
Helper protocol that helps initilizing views with xib. This gist is only valid when `xib file` has same file name with `swift file`
public protocol XibGenerated {
func setUpXib()
func setUpViews()
}
extension XibGenerated where Self: UIView {
public func setUpXib(bundle: Bundle? = nil) {
let viewType = type(of: self)
let bundle = bundle ?? Bundle(for: viewType)
let nibName = String(describing: viewType)
class AppDelegate: UIApplicationDelegate {
func application(_ app: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler _: @escaping (UIBackgroundFetchResult) -> Void) {
rootNavigationController.navigate(with: userInfo)
}
}
class MyNavigationController: UINavigationController {
func navigate(with userInfo: [String: AnyObject?] {