Skip to content

Instantly share code, notes, and snippets.

View oozoofrog's full-sized avatar

oozoofrog oozoofrog

View GitHub Profile
try:
import lldb
except:
pass
import textwrap
import hashlib
from collections import namedtuple
object_register = ""
@oozoofrog
oozoofrog / NotificationConcurrencyTests.swift
Last active December 24, 2022 05:31
NotfiicationCenter+Concurrency test case
extension Notification.Name {
static let testNotification: Notification.Name = .init("TestNotification")
}
final class NotificationConcurrencyTests: XCTestCase {
func testWaitNotification() async throws {
let expect = XCTestExpectation(description: "DisposableNotification")
let queue = DispatchQueue(label: "test", attributes: .concurrent)
for _ in 0...10 {
@oozoofrog
oozoofrog / NotificationCenter+Concurrency.swift
Last active December 24, 2022 13:02
disposable notification
public extension NotificationCenter {
private class FirstReceiver: NSObject {
let notificationName: Notification.Name
init(_ name: Notification.Name) {
notificationName = name
super.init()
}
final class PreviewView: UIView, LayoutBuilding {
var capTop = true {
didSet {
UIView.animate(withDuration: 1.0) {
self.updateLayout()
}
}
}

Debugging the Swift Toolchain

Use these steps to debug components of the Swift toolchain. This allows you to see Swift's source code from the debugger – instead of disassembly. The debugger can also provide some variable names and values. This has been initially tested with libswiftCore.dylib.

These instructions were updated as of Swift 5.2.1.

Prerequisites

@oozoofrog
oozoofrog / gist:07d7eec63750c4992b09e2709f180497
Last active November 13, 2022 10:49
한글 유니코드 다루기
import Cocoa
var str = "궉토abcd스234꾹타ㅎ하후훼의"
extension Collection {
var toArray: [Element] {
return Array(self)
}
}
protocol UnicodeScalarCreatable {
@oozoofrog
oozoofrog / keybase.md
Created September 21, 2018 02:08
keybase.md

Keybase proof

I hereby claim:

  • I am rollmind on github.
  • I am rollmind (https://keybase.io/rollmind) on keybase.
  • I have a public key ASDHVKuqfnxsGNBCmHuUiLoLqU4GdFa6tJUiK3tKYF95vgo

To claim this, I am signing this object:

@oozoofrog
oozoofrog / BeAddible
Created May 16, 2018 22:07
protocol, generic, extension, conditional conformance
struct Be<Value> {
let value: Value
}
protocol BeAddible {
var be: Be<Self> { get }
}
extension Be where Value: Comparable {
@oozoofrog
oozoofrog / 테스트케이스
Last active May 4, 2018 03:02
XCTRxHandle 테스트 케이스
let scheduler = ConcurrentDispatchQueueScheduler.init(qos: DispatchQoS.userInteractive)
let a = Observable<Int>.just(3).delay(3, scheduler: scheduler).debug("A")
let b = Observable<Int>.just(2).delay(2, scheduler: scheduler).debug("B")
// observable의 stream은 3을 전달. error 없음, XCTWaiter.Result는 completed
XCTRxHandle(testcase: self, timeout: 5, observable: a, value: {
XCTAssertEqual($0, 3)
}, error: {
XCTAssertNil($0)
}, result: {
XCTAssertEqual($0, .completed)
@oozoofrog
oozoofrog / XCTRxHandle
Last active May 2, 2018 05:44
aysynchronous Rx Observable test handle function
public func XCTRxHandle<Element>(_ description: String = "XCTAssertForRx", testcase: XCTestCase, timeout: TimeInterval = 1, queue: DispatchQueue = DispatchQueue(label: "Rx queue"), observable: Observable<Element>, trigger: @autoclosure @escaping () -> Void = {}(), value onNext: @escaping (Element?) -> Void = { _ in }, completed: @autoclosure @escaping () -> Void = {}(), error onError: @escaping (Error?) -> Void = { _ in }, result: (XCTWaiter.Result) -> Void = { _ in } ) {
let expect = testcase.expectation(description: description)
expect.assertForOverFulfill = false
let bag = DisposeBag()
queue.async {
observable.subscribe({ (event) in
switch event {
case .error(let error):
onError(error)