This file contains hidden or 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
// DEVELOPER_DIR=/Applications/Xcode9-beta.app/Contents/Developer/ swift text-to-flags.swift | |
import Foundation | |
let input = CommandLine.arguments[1].uppercased() | |
if input.rangeOfCharacter(from: CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZ").inverted) != nil { | |
fatalError("unsupported character found") | |
} | |
func request(_ r: URLRequest) -> [String] { |
This file contains hidden or 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
grep -rlZE "(UI[a-zA-Z]*View|CG[A-Za-z]*)" --include "*.swift" --exclude-dir Pods . | tr '\n' '\0' | xargs -0 grep -LZ "^import UIKit" |
This file contains hidden or 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 | |
DOC="$1" | |
if [ -z "$DOC" ] | |
then | |
DOC="." | |
fi | |
open -a "Visual Studio Code" "$DOC" |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DVTConsoleDebuggerInputTextColor</key> | |
<string>0.794852 1 0.923414 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>Courier - 13.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>1 0.93397 0.612968 1</string> |
This file contains hidden or 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 | |
// Edit this dictionary to contain every suite of mocks you need | |
// [targetfile : [option1, option2...]] | |
let mappings = [ | |
"users-rewrite.json": [ | |
"users.json", // Standard response | |
"users-empty.json", // No users available | |
"users-401.json", // Token expired state | |
"users-500.json", // Server broken state |
This file contains hidden or 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 AppKit | |
import IOKit | |
import IOKit.hid | |
let manager = IOHIDManagerCreate( | |
kCFAllocatorDefault, | |
IOOptionBits(kIOHIDOptionsTypeNone) | |
) |
This file contains hidden or 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 | |
CONFIG_PASSWORD="BE5D2905-0625-4EBF-BCA2-7F6F5D138425" | |
REQUIRED_CONFIG_FILE_PATH="${SRCROOT}/YourProject/App/Config/Configurations/Config-${CONFIGURATION}.plist" | |
CONFIG_OUTPUT_PATH="${SRCROOT}/YourProject/App/Config/Configurations/Config.json" | |
CONFIG_EXTENSION_OUTPUT_PATH="${SRCROOT}/YourProject/App/Config/Configurations/Config+Extension.swift" | |
set -e | |
if [ -z "${CONFIGURATION}" ] |
This file contains hidden or 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 | |
# Start this in the morning when you get to work | |
# Control+C to kill it before you leave | |
# The time spent is printed on the screen | |
# Use it to make a case for a faster laptop! | |
INTERVAL=5 | |
COMPILE_TIME=0 |
This file contains hidden or 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
// An example of iterating through an `Object`'s properties and deleting them | |
// Logging has been left for clarity | |
// Objects conforming to `DefersDeletionDuringCascade` can decide whether they should be deleted or not | |
// Not fully tested, but works so far! | |
import Foundation | |
import RealmSwift | |
fileprivate func log(_ s: String, level: Int) { | |
// This levelled logging is super useful |
This file contains hidden or 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 UIColor { | |
private var components: (CGFloat, CGFloat, CGFloat, CGFloat)? { | |
var r: CGFloat = 0.0 | |
var g: CGFloat = 0.0 | |
var b: CGFloat = 0.0 | |
var a: CGFloat = 0.0 | |
guard getRed(&r, green: &g, blue: &b, alpha: &a) else { return nil } | |