Skip to content

Instantly share code, notes, and snippets.

View mr-fixit's full-sized avatar

Eric Slosser mr-fixit

  • Boston
View GitHub Profile
@mr-fixit
mr-fixit / README.md
Last active May 25, 2023 15:19
To get the versions of your SPM packages

Example

At runtime

   SPMVersions.versionOf("THE_PACKAGE_ID")

In Terminal

#!/bin/bash
# scan path[s] for files, folders or ZIPs containing Xcode projects with suspicious contents
if [[ $# == 0 ]]; then
echo "usage: $0 [--verbose] path [path2 ...]"
echo " path can be a folder or a file"
exit
fi
function do_file() {
func random1() -> CGFloat {
return CGFloat(arc4random()) / CGFloat(UINT32_MAX)
}
extension UIColor {
static func random() -> UIColor {
return UIColor.init(red: random1(), green: random1(), blue: random1(), alpha: 0.1)
}
}
@mr-fixit
mr-fixit / gist:93babda8fa0c3db4d53a
Created January 13, 2016 18:41
bulk delete ios simulators
xcrun simctl list devices | awk '/-- .* --/ { if ( $2 == "iOS" && $3 ~ /8*/ ) { inIOS = 1 } else { inIOS = 0 }}; { if ( inIOS && match($0,/\([0-9A-F\-]*\)/) ) { print substr($0,RSTART+1, RLENGTH-2) }} ' | xargs -I {} xcrun simctl delete {}
#!/bin/bash
# given a spreadsheet, create a Localizable.strings file for a given language
cat localized.csv |
while IFS=',' read devConst devValue englishValue spanishValue; do
if [[ $devValue ]]; then
devConst=`echo "$devConst" | tr -d '/* '`