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
tell application "Calendar" | |
-- delete everything from the destination calendar | |
-- TODO: Change "Destination Calendar" to be the name of your destination calendar | |
repeat with anEvent in (get events of calendar "Destination Calendar") | |
delete anEvent | |
end repeat | |
-- copy all events from the source calendar to the destination | |
-- TODO: Change "Source Calendar" to be the name of your source calendar | |
-- TODO: Change "Destination Calendar" to be the name of your destination calendar |
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 xcrun swift | |
import Foundation | |
let kDelayUSec : useconds_t = 500_000 | |
func DragMouse(from p0: CGPoint, to p1: CGPoint) { | |
let mouseDown = CGEventCreateMouseEvent(nil, .LeftMouseDown, p0, .Left) | |
let mouseDrag = CGEventCreateMouseEvent(nil, .LeftMouseDragged, p1, .Left) | |
let mouseUp = CGEventCreateMouseEvent(nil, .LeftMouseUp, p1, .Left) |
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 | |
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 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 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 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? |
NewerOlder