Skip to content

Instantly share code, notes, and snippets.

View billypchan's full-sized avatar
😶
Focusing

Bill Chan billypchan

😶
Focusing
View GitHub Profile
grep -r -n -i --include="*.swift" setUp .
@billypchan
billypchan / commands
Created May 2, 2019 14:26
clean up Xcode
sudo xcrun simctl delete unavailable
carthage build --no-skip-current --platform iOS
carthage archive
@billypchan
billypchan / gist:98f020061a77bb5487da8fd533282c82
Created May 3, 2019 07:59
release a new version with hub
carthage build --no-skip-current --platform iOS
carthage archive
git tag 1.1.1
git push --tags
hub release create -F release.txt -a DifferenceKit.framework.zip 1.1.1
@billypchan
billypchan / gist:c004d0e7126e5a5ecee0e6814afef4a6
Last active March 27, 2020 14:29
debug iOS13 device wieth Xcode 10
sudo ln -s /Applications/Xcode11.4.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.4 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
@billypchan
billypchan / lint.sh
Last active March 11, 2020 14:18
git: compare with delevop branch, then run swiftLint only on changed swift files
## put this file under /usr/local/bin
git diff develop --name-only | while read filename; do
if [[ $filename == *.swift ]]
then
swiftlint autocorrect --path "$filename";
fi
done
@billypchan
billypchan / cleanXCode.sh
Created January 17, 2020 13:37
cleanXCode.sh: copy this to /usr/local/bin and chmod +x
rm -rf ~/Desktop/DerivedData
@billypchan
billypchan / main.swift
Created December 1, 2020 16:15
Scan Cartfile.resolved, update azure-pipelines.yml, then create PR on every child repo
//
// main.swift
// CreateChangeAzureBranchPR
//
// Created by bill on 30.11.20.
//
import Foundation
let branch = "chore/azure_xcode12"
@billypchan
billypchan / main.swift
Created September 17, 2021 08:21
Create a PR for each frameworks in Cartfile.resolved for edited azure-pipelines.yml for Xcode 13 update
//
// main.swift
// carthageGraph
//
// Created by Bill, Yiu Por Chan on 17.09.21.
//
import Foundation
var path: String! = "/Users/bill/ios_dev/wire/xcode13/wire-ios/Cartfile.resolved"
@billypchan
billypchan / ThreeDiceMod4Chance.swift
Created September 26, 2021 17:32
Find the chance when rolling 3 dices the the reminder of divid the sum by 4.
import Foundation
func diceChance() {
var sums = [Int: Int]()
for i in 1...6 {
for j in 1...6 {
for k in 1...6 {
sums[i+j+k, default: 0] += 1
}
}