Skip to content

Instantly share code, notes, and snippets.

View wongzigii's full-sized avatar
🎯
Focusing

Wong wongzigii

🎯
Focusing
View GitHub Profile
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
private var array = [Element]()
public init() { }
GET /mobile-app/charging-cn/get-locks?deviceLanguage=zh&deviceCountry=CN&vin=5YJ3E7EB1KF205252&siteId=14937 HTTP/1.1
Host: ownership.tesla.cn
Accept: */*
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFQTXpfbDNvamZ1U3B1SWR2eW4tODBuZ0ZpSSJ9.eyJpc3MiOiJodHRwczovL2F1dGgudGVzbGEuY24vb2F1dGgyL3YzIiwiYXVkIjpbImh0dHBzOi8vb3duZXItYXBpLnRlc2xhbW90b3JzLmNvbS8iLCJodHRwczovL2F1dGgudGVzbGEuY24vb2F1dGgyL3YzL3VzZXJpbmZvIl0sImF6cCI6Im93bmVyYXBpIiwic3ViIjoiZTZmMGYyMDQtMWQyOS00NTlhLThjYWEtOTJiMWM4OTlkYTAzIiwic2NwIjpbIm9wZW5pZCIsImVtYWlsIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInB3ZCJdLCJleHAiOjE2Mzg4MDAyNDksImlhdCI6MTYzODc3MTQ0OSwiYXV0aF90aW1lIjoxNjM4NzcxNDQ5fQ.klEe8cECNyPtcNyFKFYvO6zTJQLv2Tg-yCGeiFv_bzWu5FGU8UxGbXUhJK9tb7NGTT-0abc7KZdQWE7qdOUHwJZQQgX7kIpM2w4o2Ar0YUzQSoT2CEE60AoXyNmiasH8Wh9NYEaP4jainziC1I3Pp-299phVGJD0pKdKJoXz02s0N54VFKo2yrRThfCtj8YajAxAsBCWC2s8YaawCix-0esGOL-46M-zJaM46_1ZUaBF-wJkoxg_0TfMIiIp-B7WcNxHmjt7ukucap3HS0dLZQMypFqcWMpKBi_n34ziV2HoXXyk7Mq2aHZorT547c5LZJIpD4Hxgl7_LIxv3Zkhk8O-v0CM9nNaksvC
{
"https-clone-pattern": "https://github.com/%s.git",
"ssh-clone-pattern": "git@github.com:%s.git",
"repos": {
"sourcekit-lsp": {
"remote": {
"id": "apple/sourcekit-lsp"
}
},
"swift-syntax": {
➜ swift git:(main) ✗ utils/run-test --lit ../llvm-project/llvm/utils/lit/lit.py \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m)
--- Building test dependencies all, SwiftUnitTests, swift-test-stdlib-macosx-x86_64 ---
+ cmake --build /Users/zigiiwong/new-swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64 -- -j8 all SwiftUnitTests swift-test-stdlib-macosx-x86_64
ninja: no work to do.
+ cmake --build /Users/zigiiwong/new-swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64 -- -j8 upload-stdlib-macosx-x86_64
ninja: no work to do.
--- Build finished ---
+ /usr/local/opt/python@3.9/bin/python3.9 ../llvm-project/llvm/utils/lit/lit.py -sv --param swift_test_mode=optimize_none --param swift_test_subset=primary /Users/zigiiwong/new-swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64
@wongzigii
wongzigii / demo.swift
Last active March 23, 2021 14:01
Demo.swift
import RxSwift
import RxCocoa
import RxSwiftExt
class AccquiredItemViewModel: PaginationViewModel<EggProduct> {
var selection = PublishSubject<EggProduct>()
var preselectedProduct = PublishSubject<EggProduct>()
@wongzigii
wongzigii / debounce.swift
Created March 15, 2021 02:49 — forked from DoubleREW/debounce.swift
Debounce Function for Swift 3 (implemented with OperationQueue)
extension OperationQueue {
/// Creates a debounced function that delays invoking `action` until after `delay` seconds have elapsed since the last time the debounced function was invoked.
///
/// - Parameters:
/// - delay: The number of seconds to delay.
/// - underlyingQueue: An optional background queue to run the function
/// - action: The function to debounce.
/// - Returns: Returns the new debounced function.
open class func debounce(delay: TimeInterval, underlyingQueue: DispatchQueue? = nil, action: @escaping () -> Void) -> (() -> Void) {
@wongzigii
wongzigii / AsynchronousOperation.swift
Created March 11, 2021 09:30 — forked from Sorix/AsynchronousOperation.swift
Subclass of NSOperation (Operation) to make it asynchronous in Swift 3, 4, 5
// Created by Vasily Ulianov on 09.02.17, updated in 2019.
// License: MIT
import Foundation
/// Subclass of `Operation` that adds support of asynchronous operations.
/// 1. Call `super.main()` when override `main` method.
/// 2. When operation is finished or cancelled set `state = .finished` or `finish()`
open class AsynchronousOperation: Operation {
public override var isAsynchronous: Bool {

Keybase proof

I hereby claim:

  • I am wongzigii on github.
  • I am wongzigii (https://keybase.io/wongzigii) on keybase.
  • I have a public key ASAb5qnlXCScoULbvie73Z6joBONE8xKk3zaEn-TTEmPigo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am wongzigii on github.
* I am wongzigii (https://keybase.io/wongzigii) on keybase.
* I have a public key ASCn8Mg_ycB69aLhl5yqh9KBIc7kx_ted1_YDWtnWYh8Qwo
To claim this, I am signing this object:
@wongzigii
wongzigii / script.sh
Created January 22, 2019 03:12
Reset Xcode AppStore transporter
cd ~
rm -rf .old_itmstransporter/
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"