Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
var dict: [String: Any?] = ["a": nil, "b": 0, "c": 1] | |
// 1. Map and comapctMap | |
// This works. Although the dictionary value is still optional even though it could never be nil here 👍 | |
let mappedDict = dict.map { return $0.value != nil ? $0 : nil }.compactMap { $0 } | |
print(mappedDict) | |
// 2. Filter | |
// Filtering achieves the same | |
let filteredDict = dict.filter { $0.value != nil } |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
*.strings utf16 diff=localizablestrings |
extension Optional where Wrapped: Collection { | |
var isNilOrEmpty: Bool { | |
return self?.isEmpty ?? true | |
} | |
} | |
// MARK: - Tests | |
func testNilOrEmpty() { |
extension UIViewController { | |
/// Traverse up the responder chain until we find a `UINavigationController`. | |
func findNavigationController() -> UINavigationController? { | |
if let nextResponder = self.next as? UINavigationController { | |
return nextResponder | |
} else if let nextResponder = self.next as? UIViewController { | |
return nextResponder.findNavigationController() | |
} else { | |
return nil |
Host * | |
ServerAliveInterval 600 | |
TCPKeepAlive yes | |
IPQoS=throughput |
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done |
#!/usr/bin/env bash | |
# | |
# bump-ios-app-version | |
# Usage example: ./bump-ios-app-version minor apps/app-ios-parking/SupportingFiles/Info.plist | |
component=$1 | |
info_plist_path=$2 | |
version=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ${info_plist_path}) |
#!/usr/bin/env bash | |
# | |
# lint-devices-file | |
# Usage example: ./scripts/ios/lint-devices-file fastlane/devices.txt | |
FILE=$1 | |
TAB_COUNT=$(grep "$(printf '\t')" $FILE | wc -l) | |
NEW_LINE_COUNT=$(grep "$(printf '\n')" $FILE | wc -l) |