Skip to content

Instantly share code, notes, and snippets.

View billypchan's full-sized avatar
😶
Focusing

Bill Chan billypchan

😶
Focusing
View GitHub Profile
@billypchan
billypchan / BST_Sequences.swift
Created December 20, 2023 23:57
Swift BST Sequences answer
//
// main.swift
// BST_Sequences
//
// Created by Bill, Yiu Por Chan on 12/20/23.
//
import Foundation
class Node {
@billypchan
billypchan / PhraseListStringID.swift
Last active July 18, 2023 20:48
Getting Phrase.com String rsc key and id
import Cocoa
import Foundation
// Set up your authentication token
let authToken = "authToken"
// Specify the project ID
let projectId = "projectId"
@billypchan
billypchan / LocalizeCatalogCodable.swift
Last active July 18, 2023 12:04
decode Localizable.xcstrings
//
// main.swift
// LocalizeCatalogCodable
//
// Created by Bill, Yiu Por Chan on 18.07.23.
//
import Foundation
struct Localizable: Codable {
@billypchan
billypchan / xcstrings.swift
Last active July 18, 2023 09:44
Export TrackData to Xcode 15 Localization catalog
struct TrackData: Codable {
var strings: [String: Track]
}
struct Track: Codable {
let extractionState: String
let localizations: [String: Localization]
}
struct Localization: Codable {
@billypchan
billypchan / cleanBumpBranches.sh
Last active January 13, 2022 15:24
Clean up all bump PR branches
##clean up all remote branches with name "chore/bump_*"
cleanGitBranch.sh
git branch -r --sort=-committerdate --list 'origin/chore/bump_*' | sed "s/origin\///" | xargs -I {} git push origin --delete {}
@billypchan
billypchan / .gitignore
Last active October 26, 2021 14:00 — forked from onmyway133/.gitignore
AutoLayoutConverter - 🐜 Convert Cartography to NSLayoutAnchor
.DS_Store
.tags*
/.idea/
/build/
/dist/
/external_binaries/
/out/
/vendor/download/
/vendor/debian_jessie_amd64-sysroot/
/vendor/debian_jessie_arm-sysroot/
@billypchan
billypchan / dummyPR.sh
Created October 26, 2021 13:18
Create dummy Github PR and make a comment on bash
git checkout develop
git pull
echo "Time: $(date)." > a.txt
cleanGitBranch.sh
git branch chore/bump
git checkout chore/bump
git add .
git commit -m"dummy"
@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
}
}
@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 / 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"