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 | |
import CoreData | |
protocol CoreDataGettable where Self: NSManagedObject { | |
static func getSingle(id: String, context: NSManagedObjectContext) -> Self? | |
static func getList(accId: String, context: NSManagedObjectContext) -> [Self] | |
static func getSingle(withPredicate predicate: String, args: CVarArg, context: NSManagedObjectContext) -> Self? | |
} | |
extension CoreDataGettable { |
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
extension UIImageView { | |
/// Loads image from web asynchronosly and caches it, in case you have to load url | |
/// again, it will be loaded from cache if available | |
/// - parameter url: URL for the image | |
/// - parameter placeholder: Placeholder image to use while image is downloading, defaults to nil | |
/// - parameter template: True to use template image rendering mode, false to use original image | |
/// rendering mode, defaults to false | |
func load(url: URL, placeholder: UIImage? = nil, template: Bool = false) { | |
let cache = URLCache.shared | |
let request = URLRequest(url: url) |
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
export CLICOLOR=1 | |
bind "set completion-ignore-case on" # Persists tab-completion case-insensitive | |
bind "set show-all-if-ambiguous on" # Persists tab-completion case-insensitive | |
# ----------------------------- | |
# MAKE TERMINAL BETTER | |
# ----------------------------- | |
alias nosleep='caffeinate -d -i -s -u' |