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 Optional { | |
func unwrap(orThrow error: @autoclosure () -> Error) throws -> Wrapped { | |
guard let value = self else { | |
throw error() | |
} | |
return value | |
} |
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
#!/usr/bin/env bash | |
# Downloads Github's recommended .gitignore for the specified language and prints it to stdout. | |
# | |
# When starting a project: | |
# gh-gitignore Swift > .gitignore | |
set -euo pipefail | |
E_BADARGS=85 |
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
#!/usr/bin/env bash | |
# Converts a legacy framework into an xcframework. | |
# Usage: convert-framework.sh input_framework output_xcframework | |
set -euo pipefail | |
E_BADARGS=85 | |
if [ $# -ne 2 ]; then | |
echo "Usage: $(basename $0) framework xcframework" |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
cat <<SWIFT | |
// | |
// GitRevision.swift | |
// | |
// This file was automatically generated. Do not edit manually. It will be overwritten on every build. | |
// |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
E_BADARGS=85 | |
if [ $# -ne 1 ]; then | |
echo "Usage: $(basename $0) tag-name" | |
exit $E_BADARGS | |
fi |
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 | |
class SimulatedOperation { | |
// Simulated function that collects data from multiple async calls. | |
// Build an array of [String] values, one element per async call. Hit the | |
// completion block once all of the elements are populated. | |
func collectData(completion: @escaping ([String]) -> Void) { | |
// Locally accumulate the results here. Why does this work? |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
import json | |
try: | |
json.dump(json.load(sys.stdin), sys.stdout, sort_keys=True, indent=4) | |
except ValueError as err: | |
print("Error:", err, file=sys.stderr) |
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
#!/usr/bin/env python | |
import argparse | |
import codecs | |
import json | |
import subprocess | |
import sys | |
def parse_args(argv): | |
if argv is None: |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
echo "Exiting Xcode" | |
osascript -e 'quit app "Xcode"' | |
echo "Deleting DerivedData" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* |
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
#!/usr/bin/env python | |
import argparse | |
import codecs | |
import subprocess | |
import sys | |
def parse_args(argv): | |
if argv is None: | |
argv = sys.argv[1:] |
NewerOlder