Or: “Everybody likes being given a glass of water.”
By Merlin Mann.
It's only advice for you because it had to be advice for me.
| // | |
| // ColorSchemeApp.swift | |
| // ColorScheme | |
| // | |
| // Created by Craig Hockenberry on 9/11/24. | |
| // | |
| import SwiftUI | |
| @main |
| #!/bin/sh | |
| # usage: | |
| # ql /tmp/file.jpg | |
| # cat /tmp/file.jpg | ql | |
| # cal -h | ql | |
| if [ -z "$*" ]; then | |
| cat > /tmp/ql.stdin | |
| mime_type=$(file --brief --mime-type /tmp/ql.stdin) |
| import UIKit | |
| extension UIFont { | |
| /// Watch [WWDC Session](https://developer.apple.com/videos/play/wwdc2015/804/). | |
| /// [Font Feature Registry](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html) | |
| /// - Parameters: | |
| /// - size: The size (in points) to which the font is scaled. This value must be greater than 0.0. | |
| /// - weight: The weight of the font, specified as a font weight constant. | |
| /// - features: Font features supported by SFPro |
legacy = UIGraphicsBeginImageContextWithOptions + UIGraphicsEndImageContext
modern = UIGraphicsImageRendererFormat + UIGraphicsImageRenderer
prefersExtendedRange = NO
prefersExtendedRange = YES| #import <Foundation/Foundation.h> | |
| static NSString * _Nonnull ActuallyLocalizedStringForStatusCode(NSInteger statusCode) | |
| { | |
| static NSBundle *cfNetworkBundle; | |
| static dispatch_once_t once; | |
| dispatch_once(&once, ^{ | |
| cfNetworkBundle = [NSBundle bundleForClass:NSHTTPURLResponse.class]; | |
| }); | |
| NSString *httpError = [NSHTTPURLResponse localizedStringForStatusCode:statusCode]; |
| import Foundation | |
| final class Sample: NSObject { | |
| @objc dynamic var name: String = "" | |
| } | |
| class MyObj: NSObject { | |
| @objc dynamic var test: String = "" | |
| } | |
| extension NSObjectProtocol where Self: NSObject { |
| // UDID is no longer available in iOS 6+ due to security / privacy reasons. It can't be retreived the old way | |
| // even when AirWatch MDM is used, because, the APIs are not available. | |
| // However, in order to find more info from AirWatch for the enrolled device and the associated user, we need | |
| // to have UDID, Serial Number or Mac Address which can't be accessed directly either. | |
| // During the installation process, AirWatch pushes a profile and certificate to the user's device which | |
| // contains the UDID. | |
| // This operates on the assumption that AirWatch is configured to push the UDID to the device during the |
| #!/bin/bash -e | |
| if [ "${CONFIGURATION}" != "Debug" ]; then | |
| exit 0 | |
| fi | |
| REVEAL_APP_PATH=$(mdfind -onlyin / "kMDItemCFBundleIdentifier == com.ittybittyapps.Reveal" | head -n 1) | |
| if [ ! -d "${REVEAL_APP_PATH}" ]; then | |
| echo "warning: Reveal.app not found." | |
| exit 0 |
| func unwrap<T1, T2>(optional1: T1?, optional2: T2?) -> (T1, T2)? { | |
| switch (optional1, optional2) { | |
| case let (.Some(value1), .Some(value2)): | |
| return (value1, value2) | |
| default: | |
| return nil | |
| } | |
| } | |
| func unwrap<T1, T2, T3>(optional1: T1?, optional2: T2?, optional3: T3?) -> (T1, T2, T3)? { |