Skip to content

Instantly share code, notes, and snippets.

View xiangyu-sun's full-sized avatar

Xiangyu Sun xiangyu-sun

View GitHub Profile
expect\(([^\)]+)\)\.to\(beFalse\(\)\)
XCTAssertFalse($1)
expect\(([^\)]+)\)\.to\(beTrue\(\)\)
XCTAssertTrue($1)
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
frame #0: 0x000000011e2cba44 libswiftCore.dylib`merged Swift._ArrayBuffer.endIndex.getter : Swift.Int + 64
frame #1: 0x000000011e2ce810 libswiftCore.dylib`protocol witness for Swift.Collection.endIndex.getter : τ_0_0.Index in conformance Swift.Array<τ_0_0> : Swift.Collection in Swift + 32
frame #2: 0x000000011e31773c libswiftCore.dylib`protocol witness for Swift.IteratorProtocol.next() -> Swift.Optional<τ_0_0.Element> in conformance Swift.IndexingIterator<τ_0_0> : Swift.IteratorProtocol in Swift + 176
frame #3: 0x000000011e3cc2a0 libswiftCore.dylib`Swift.Sequence.first(where: (τ_0_0.Element) throws -> Swift.Bool) throws -> Swift.Optional<τ_0_0.Element> + 352
* frame #4: 0x00000001190e87a0 StoreSharedTypes`StoreEntityProtocol.handlingStrategy.getter(self=StoreSharedTypes.StoreEntity @ 0x000000016f7da3c8) at StoreEntityProtocol.swift:36:45
frame #5: 0x0000000100f83334 MyApp`static EventModel.S
main:
xor eax, eax
ret
output.EventModel.StoreImpression.position.getter : Swift.Int:
mov rax, qword ptr [r13]
ret
output.EventModel.StoreImpression.filterData.getter : output.EventModel.AppliedFilters?:
push rbp
main:
xor eax, eax
ret
output.EventModel.StoreImpression.position.getter : Swift.Int:
mov rax, qword ptr [r13]
ret
output.EventModel.StoreImpression.filterData.getter : output.EventModel.AppliedFilters?:
push rbp
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x525548)
frame #0: 0x0000000134011b9c libswiftCore.dylib`swift_retain + 40
frame #1: 0x0000000287a09f14 AnalyticsTesting`outlined init with copy of AppEvent at <compiler-generated>:0
* frame #2: 0x0000000287a04c68 AnalyticsTesting`AppEventServiceMock.handle(event=storeImpression, self=0x00000002f88aa120) at AppEventServiceMock.swift:27:24
frame #3: 0x0000000287a0e3f4 AnalyticsTesting`protocol witness for AppEventServiceProtocol.handle(event:) in conformance AppEventServiceMock at <compiler-generated>:0
frame #4: 0x0000000106827614 MyModule`FeedImpressionManager.sendImpressionEvent(impressionData=Discovery.FeedImpressionData @ 0x000000016b5ebde0, self=0x00000002d8bd9b10) at FeedImpressionManager.swift:311:28
frame #5: 0x0000000106815be4 MyModule`protocol witness for ImpressionDataManagerProtocol.sendImpressionEvent(for:) in conformance FeedImpressionManager at <compiler-generated>:0
frame #6:
enum EventModel {}
extension EventModel {
struct StoreImpression: Equatable {
public let position: Int
public let filterData: AppliedFilters?
public let searchId: String
public let deliveryFeeCurrency: String
struct TaichiView: View {
@State private var rotation = 0.0
var body: some View {
ZStack {
// Taichi symbol
ZStack {
// Yang
Path { path in
let radius = 80.0
@xiangyu-sun
xiangyu-sun / gist:f1b4fae79727474d16c52aed181f5d34
Created October 20, 2021 10:23
m1_pyenv_python_install.sh
#!/bin/bash
brew='/usr/local/Homebrew/bin/brew'
$brew config
echo "Installing Dependencies"
$brew install readline
$brew install zlib
$brew install bzip2
echo "Done!"
@xiangyu-sun
xiangyu-sun / GeometryReader that does not mess up with sizing!
Created June 9, 2021 06:38
GeometryReader that does not mess up with sizing!
import SwiftUI
//Nick Cook
//@cookednick​
struct PassiveGeometryReader<Content: View>: View {
init(@ViewBuilder content: @escaping (PassiveGeometryProxy) -> Content) {
self.content = content
proxy = PassiveGeometryProxy(size: .zero, safeAreaInsets: .zero)
}
@xiangyu-sun
xiangyu-sun / gist:e57c5162f2406b512f5a53131cdd5967
Created July 3, 2020 08:56
Using apple's formatter to get Chinese yang calendar detail
let calendar = Calendar(identifier: .chinese)
let formatter = DateFormatter()
formatter.calendar = calendar
formatter.dateStyle = .long
let regex = try? NSRegularExpression(pattern: ##"(\w*)-(\w*)"##)
let str = formatter.string(from: self)
let matches = regex?.matches(in: str, options: [], range: NSRange(location: 0, length: str.count))
var dizhi: String?