Skip to content

Instantly share code, notes, and snippets.

View lijie121210's full-sized avatar

viwii lijie121210

View GitHub Profile
@dastrobu
dastrobu / PointerArithmetic.swift
Last active July 9, 2024 09:54
Swift Pointer Arithmetic for C Interoperability
struct MyStruct {
var n: Int
func sayHello() {
print("hello")
}
}
var s: MyStruct = MyStruct(n: 1)
var a: [UInt8] = []
@SergLam
SergLam / UITableView+Refresh.swift
Last active December 9, 2024 18:34
UITableView - safe reload + section headers+footers reload without animation
import UIKit
extension UITableView {
func isCellVisible(section: Int, row: Int) -> Bool {
guard let indexes = self.indexPathsForVisibleRows else {
return false
}
return indexes.contains{ $0.section == section && $0.row == row }
}
import Foundation
@propertyWrapper
public struct Validate<Value> {
fileprivate let _isValid: (Value) -> Bool
public let asserts: Bool
public let useLastValid: Bool
public let message: (Value) -> String
@JagoWang
JagoWang / gist:4509553
Last active February 2, 2025 14:38
Mac port使用
Mac Port 基本用法总结
1. Mac Port的下载地址
http://www.macports.org/install.php
2. Mac Port的说明文档
http://guide.macports.org/
3. Mac Port中第三方软件下载包存放的默认路径是:/opt/local/var/macports/distfiles/
为了提高安装速度,可以在安装新port时直接将此目录下的文件拷贝到新的Mac Port相同的目录中就可以避免Port去网上下载。