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
enum ExternalIntent { | |
case content(id: String) | |
case timeline | |
case example | |
init?(launchOptions: [UIApplicationLaunchOptionsKey: Any]?) { | |
guard let launchOptions = launchOptions else { return nil } | |
if let url = launchOptions[.url] as? URL { | |
self.init(url: url) | |
} else if let shortcutItem = launchOptions[.shortcutItem] as? UIApplicationShortcutItem { |
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 UITableView { | |
//deselect any row that may be selected | |
public func deselectAnyRow(animated: Bool = true) { | |
if let indexPath = self.indexPathForSelectedRow { | |
self.deselectRow(at: indexPath, animated: animated) | |
} | |
} | |
} |
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 SwiftyJSON | |
extension JSON { | |
public var decimal: Decimal? { | |
get { | |
switch self.type { | |
case .string: | |
return Decimal(string: self.object as! String) | |
case .number: |
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
public extension UIFont { | |
public class func systemFont(ofSize fontSize: CGFloat, weight: UIFontWeight) -> UIFont { | |
return .systemFont(ofSize: fontSize, weight: weight.floatValue) | |
} | |
public class func monospacedDigitSystemFont(ofSize fontSize: CGFloat, weight: UIFontWeight) -> UIFont { | |
return .monospacedDigitSystemFont(ofSize: fontSize, weight: weight.floatValue) | |
} | |
} |
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 Collection { | |
public subscript(safe index: Index) -> Optional<Iterator.Element> { | |
guard self.startIndex..<self.endIndex ~= index else { return nil } | |
return self[index] | |
} | |
} |
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
#!/bin/bash | |
set -e | |
SCALEWAY='scw --region="ams1"' | |
ARCH=X64 | |
COMM_TYPE=$ARCH-2GB | |
IMAGE=xenial | |
TRANSFERS=7 | |
TG_TOKEN=<BOT_TOKEN> |
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 | |
/// Custom FontWeights to be used with the .font UIFont class functions | |
public enum FontWeight: String { | |
case regular = "Regular" | |
case medium = "Medium" | |
case black = "Black" | |
case light = "Light" | |
case thin = "Thin" | |
case bold = "Bold" |
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 UIKit | |
extension UIFont { | |
/// Returns the font in the specified size and weight. Default weight is `regular` | |
open class func font(ofSize fontSize: CGFloat, weight: FontWeight = .regular) -> UIFont { | |
let fontName = "UniversNextPro-\(weight.rawValue)" | |
guard let font = UIFont(name: fontName, size: fontSize) else { | |
fatalError("\(fontName) not found") | |
} | |
return font |
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
#!/bin/bash | |
IP=$(dig +short $1 | sed -n 1p) | |
whois -h whois.ripe.net -- "-T route ${IP}" |
OlderNewer