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 | |
func testIsBST() { | |
let list = [2, -10, -45, 200, 48, 10, 38, 47, 4, 2, 5] | |
var tree = BinaryTree<Int>(2) | |
for i in list[1...] { | |
tree.insert(i) | |
} | |
let test = isBST(tree) |
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
# references: https://oleb.net/2020/swift-docker-linux/ | |
# TO LAUNCH DOCKER SWIFT ENV (from package root) | |
docker pull swiftlang/swift:nightly-5.3-bionic | |
# docker run --rm --privileged --interactive --tty --volume "$(pwd):/src" --workdir "/src" swift:latest | |
docker run --rm --privileged --interactive --tty --volume "$(pwd):/src" --workdir "/src" swiftlang/swift:nightly-5.3-bionic | |
# FROM INSIDE DOCKER | |
apt-get update && apt-get upgrade | |
apt-get install libsqlite3-dev |
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
extension String { | |
var lookaheadCapture: String { | |
#"\s?\#(self)\s+(?<\#(self)>(\S++))"# | |
} | |
} |
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
extension String { | |
var lookaheadCapture: String { | |
#"\s?\#(self)\s+(?<\#(self)>(\S++))"# | |
} | |
} |
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
for f in *; do | |
if [ -d ${f} ]; then | |
cd $(echo $f) | |
echo $(pwd) | |
for g in *; do | |
if [ -d ${g} ]; then | |
# Will not run if no directories are available | |
cd $(echo $g) | |
echo $(pwd) >> ../../git-check-status-output.txt |
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
brew install cmake ninja | |
brew install sccache | |
mkdir swift-source | |
cd swift-source | |
git clone --branch swift-5.1.5-RELEASE [email protected]:apple/swift.git | |
./swift/utils/update-checkout --clone-with-ssh | |
# ./swift/utils/update-checkout --tag swift-5.1.5-RELEASE | |
# sccache --start-server | |
./swift/utils/build-script --clean --xcode --release-debuginfo | |
./swift/utils/build-script --ios --release-debuginfo |
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
enum QuicklinkBinding: Codable { | |
case icon(String) | |
case title(String) | |
case description(String) | |
case action(Action) | |
enum CodingKeys: CodingKey { | |
case icon, title, description, action | |
} | |
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
extension Array where Element == NSRange { | |
func maxRange() -> Int { | |
return self.reduce(0) { (prev, next) in | |
let maxNext = NSMaxRange(next) | |
return Swift.max(prev, maxNext) | |
} | |
} | |
} | |
extension String { |
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
brew install cmake ninja | |
mkdir swift-source | |
cd swift-source | |
git clone [email protected]:apple/swift.git | |
./swift/utils/update-checkout --clone-with-ssh | |
cd swift | |
utils/build-script --release-debuginfo | |
cd .. | |
alias st=/Users/stan/github/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/sourcekitd-test |
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
var arabic = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x0600))!...Unicode.Scalar(UInt16(0x06ff))!) | |
let arabicSupplement = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x750))!...Unicode.Scalar(UInt16(0x077f))!) | |
let arabicExtendedA = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x08a0))!...Unicode.Scalar(UInt16(0x08ff))!) | |
let arabicPresentationFormsA = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0xfb50))!...Unicode.Scalar(UInt16(0xfdff))!) | |
let arabicPresentationFormsB = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0xfe70))!...Unicode.Scalar(UInt16(0xfeff))!) | |
let rumiNumeralSymbols = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x10e60))!...Unicode.Scalar(UInt32(0x10e7f))!) | |
let indicSiyaqNumbers = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x1ec70))!...Unicode.Scalar(UInt32(0x1ecbf))!) | |
let ottomanSiyaqNumbers = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x1ed00))!...Unicode.Scalar(UInt32(0x1ed4f))!) | |
NewerOlder