This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | |
# Make sure you have a recent version: the code points that Powerline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SwiftUI Preview in Xcode is unreliabale and slow. So I started using InjectionIII plugin for previewing. | |
// AppDelegate setup | |
import SwiftUI | |
class InjectedAppDelegate: NSObject, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | |
#if DEBUG | |
var injectionBundlePath = "/Applications/InjectionIII.app/Contents/Resources" | |
#if targetEnvironment(macCatalyst) | |
injectionBundlePath = "\(injectionBundlePath)/macOSInjection.bundle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bindable<Value> { | |
typealias Binder = (Value) -> Void | |
var binder: Binder? | |
var value: Value { | |
didSet { | |
DispatchQueue.main.async { [weak self] in | |
guard let self = self else { | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func duration(_ block: () -> Void) { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
block() | |
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime | |
print(timeElapsed) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openInSublime() { | |
open -a "Sublime Text" $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Timer { | |
static func scheduleTimerEnablingBackground(timeInterval: TimeInterval, target: Any, | |
selector: Selector, userInfo: Any?, | |
repeats: Bool) -> Timer { | |
// Enable background expiration | |
UIApplication.shared.beginBackgroundTask(expirationHandler: nil) | |
let timer = Timer.scheduledTimer(timeInterval: timeInterval, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This can be used in Mac by using following trick: | |
Open trial.key at path: /Applications/Beyond\ Compare.app/Contents/Resources/trial.key | |
Replace content of trial.key with: | |
--- BEGIN LICENSE KEY --- | |
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ | |
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja | |
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t | |
q2Kw2pjoiDs5gIH-uw5U49JzOB6otS7kThBJE-H9A76u4uUvR8DKb+VcB | |
rWu5qSJGEnbsXNfJdq5L2D8QgRdV-sXHp2A-7j1X2n4WIISvU1V9koIyS |