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
deviceUdid=$(xcrun simctl create "my_simulator" "${IOS_DEVICE}" "iOS${IOS_VERSION}") | |
alias plistBuddy=/usr/libexec/PlistBuddy | |
simPrefs="$HOME/Library/Preferences/com.apple.iphonesimulator.plist" | |
plistBuddy -c "Set :DevicePreferences:$deviceUdid:ConnectHardwareKeyboard false" "$simPrefs" \ | |
|| plistBuddy -c "Add :DevicePreferences:$deviceUdid:ConnectHardwareKeyboard bool false" "$simPrefs"; |
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
Array.prototype.forEach.call(document.querySelectorAll('.timeline-comment-action'), function(el, i) { | |
el.click(); | |
}); | |
Array.prototype.forEach.call(document.querySelectorAll('button[aria-label="Delete comment"]'), function(el, i) { | |
el.removeAttribute('data-confirm'); | |
el.click(); | |
}); |
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 | |
///A type that can be encoded to a string-keyed dictionary. | |
public protocol DictionaryEncodable: Encodable {} | |
public protocol DictionaryDecodable: Decodable {} | |
///A type that can be encoded and decoded to/from a string-keyed dictionary. | |
public typealias DictionaryCodable = DictionaryEncodable & DictionaryDecodable | |
extension DictionaryEncodable { |
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
/* | |
Why? | |
- Lots of RawRepresentable boilerplate for every enum that needs a .other() case | |
- The model is polluted with an invalid case which we can't define behaviour for other than logging | |
- New method lets us handle the invalid case (e.g. log it) but then only pass on valid cases to the rest of the app | |
*/ | |
import Foundation | |
enum RawExpectation<Expected: RawRepresentable> { |
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 RealmSwift | |
import Realm | |
//Forked from: https://gist.github.com/krodak/b47ea81b3ae25ca2f10c27476bed450c | |
internal protocol CascadingDeletable: RealmSwift.Object { | |
static var propertiesToCascadeDelete: [String] { get } | |
} |
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
➜ ~ xcode-select -p | |
/Applications/Xcode-beta.app/Contents/Developer | |
➜ ~ | |
➜ ~ echo "import Foundation;print(Date())" | xcrun swift - | |
Stack dump: | |
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret - -enable-objc-interop -stack-check -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main | |
1. Apple Swift version 5.2 (swiftlang-1103.0.25.1 clang-1103.2.32.5) | |
2. While running user code "<stdin>" | |
0 swift 0x000000010ab72033 PrintStackTraceSignalHandler(void*) + 51 | |
1 swift 0x000000010ab717f0 SignalHandler(int) + 352 |
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
// | |
// RunTimeTheme.swift | |
// RunTimeTheme.swift | |
// | |
// Created by Sam Rayner on 24/10/2018. | |
// Copyright © 2018 Sam Rayner. All rights reserved. | |
// | |
import UIKit |
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 UserDefaults { | |
enum Key: String { | |
case customKey | |
} | |
//can be used for KVO | |
@objc dynamic var customKey: Int { | |
return get(.customKey) ?? 0 |
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 | |
#Help to display if the args are wrong | |
usage() { echo "Usage: $0 -o path/to/output.json" 1>&2; exit 1; } | |
#Show help if the args are wrong | |
while getopts ":o:" ARG; do | |
case "${ARG}" in | |
o) | |
OUTPUT_FILE=${OPTARG} |
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
// | |
// XibView.swift | |
// | |
// | |
// Created by Sam Rayner on 29/05/2016. | |
// Copyright © 2016 Sam Rayner. All rights reserved. | |
// | |
import UIKit |
NewerOlder