Skip to content

Instantly share code, notes, and snippets.

@Skifary
Skifary / main.m
Last active October 22, 2020 13:50
修改block的实现,先打印参数,再输出原有实现
#import <Foundation/Foundation.h>
#import "ffi.h"
NSMutableArray *g_allocations;
ffi_cif g_cif;
ffi_closure *g_closure;
void *g_replacement_invoke;
void *g_origin_invoke;
@Skifary
Skifary / main.m
Last active July 3, 2020 05:16
替换block原有实现
#import <Foundation/Foundation.h>
typedef struct __block_impl {
void *isa;
int Flags;
int Reserved;
void *FuncPtr;
}__block_impl;
typedef void(^GlobalBlock)(void);
@nzatsepilov
nzatsepilov / script.sh
Created March 20, 2018 11:08
Swiftlint script
START_DATE=$(date +"%s")
SWIFT_LINT=/usr/local/bin/swiftlint
# Run SwiftLint for given filename
run_swiftlint() {
local filename="${1}"
if [[ "${filename##*.}" == "swift" ]]; then
${SWIFT_LINT} lint --path "${filename}"
fi
@steipete
steipete / ios-xcode-device-support.sh
Last active October 14, 2024 16:35
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@tkersey
tkersey / .2025.md
Last active May 9, 2025 04:02
For future reference but maybe not.

Quick access

2025

May

  • Building an intuitive understanding of how Linear Regression works and how it leads to Gradient Descent

  • Sharing context in ways that tools understand.

    AI development tools are giving us more ability to steer them and share the context that's in our heads. Some things are my global desires, while others apply project-wide or org-wide. This has all given birth to a plethora of "rules" files that we need to manage.

@steipete
steipete / PSPDFBlockAssert.m
Created January 12, 2016 21:56
Check if object is a block - nice for assertions.
PSPDF_EXTERN BOOL PSPDFIsBlock(id _Nullable block) {
static Class blockClass;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
blockClass = [^{} class];
while ([blockClass superclass] != NSObject.class) {
blockClass = [blockClass superclass];
}
});