Skip to content

Instantly share code, notes, and snippets.

View wotjd's full-sized avatar

wotjd wotjd

  • Seoul, South Korea
View GitHub Profile
@wotjd
wotjd / layout.kbd.json
Last active May 3, 2021 15:05 — forked from yaoferrari/layout.kbd.json
Untitled Keyboard Layout
[
[
{
"a": 7
},
"",
"",
{
"x": 0.25,
"a": 0
@propertyWrapper
public struct Proxy<EnclosingSelf, Value> {
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) {
self.keyPath = keyPath
}
@available(*, unavailable)
public var wrappedValue: Value {
@wotjd
wotjd / retryInterval.swift
Last active May 24, 2020 13:50 — forked from iamchiwon/retryInterval.swift
RxSwift retry interval with condition
import RxSwift
// concept from RxSwiftExt
public enum RetryInterval {
case immediate(count: Int)
case delayed(count: Int, interval: DispatchTimeInterval)
case exponential(count: Int, initial: DispatchTimeInterval, multiplier: Int)
case custom(count: Int, delayCalculator: (Int) -> DispatchTimeInterval)
var intervals: [DispatchTimeInterval] {
@wotjd
wotjd / RepeatingTimer.swift
Last active April 3, 2020 14:47 — forked from danielgalasko/RepeatingTimer.swift
A repeating GCD timer that can run on a background queue
import Foundation
/// RepeatingTimer mimics the API of DispatchSourceTimer but in a way that prevents
/// crashes that occur from calling resume multiple times on a timer that is
/// already resumed (noted by https://github.com/SiftScience/sift-ios/issues/52
class RepeatingTimer {
// MARK: State
private enum State {
case suspended
case resumed