Skip to content

Instantly share code, notes, and snippets.

View shaotianchi's full-sized avatar
🎯
Focusing

EscapedDog shaotianchi

🎯
Focusing
View GitHub Profile
@conath
conath / Data+Hex.swift
Last active January 5, 2025 19:22
A close to complete CoreData Bluetooth peripheral implementation of the Bluetooth HID Keyboard standard. As of iOS 14, the services are blocked by the system so it's impossible to make an iOS device act as a bluetooth keyboard, for example.
import Foundation
extension Data {
init?(hexString: String) {
let len = hexString.count / 2
var data = Data(capacity: len)
for i in 0..<len {
let j = hexString.index(hexString.startIndex, offsetBy: i*2)
let k = hexString.index(j, offsetBy: 2)
let bytes = hexString[j..<k]
@JeOam
JeOam / ios.md
Last active October 10, 2017 03:15
iOS 应用性能调优 Tips

检测 ViewController 是否被释放:

- (void)dealloc{
    NSLog(@"dealloc this ViewController ");
}

注意如果使用了 block,而且 block 中引用了 self,会导致 ViewController 退出后,不被释放; 需将用到 self 的地方改为 __weak __typeof(&*self)weakSelf = self 中的 weakSelf

@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.