Skip to content

Instantly share code, notes, and snippets.

View kareman's full-sized avatar

Kare Morstol kareman

View GitHub Profile
@pyrtsa
pyrtsa / version.bash
Last active March 23, 2023 06:47
Xcode: Set version and build number from Git
#!/bin/bash
# Xcode: Set version and build number from Git
# --------------------------------------------
#
# This script sets the version number `CFBundleShortVersionString` to one of
#
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease,
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`.
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`,
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or
@beccadax
beccadax / trash.swift
Last active March 5, 2021 01:27
A trash command as a Swift script.
#!/usr/bin/xcrun swift
import Dispatch
import Cocoa
dispatch_async(dispatch_get_main_queue()) {
let URLsToRecycle = Array(dropFirst(Process.arguments)).map { NSURL(fileURLWithPath: $0) }
NSWorkspace.sharedWorkspace().recycleURLs(URLsToRecycle) { dict, error in
let recycledURLs = Array(dict.keys) as [NSURL]