Skip to content

Instantly share code, notes, and snippets.

View iJasonY's full-sized avatar
👻

JasonY iJasonY

👻
View GitHub Profile
@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);
@josephchang10
josephchang10 / blockchain.swift
Created December 27, 2017 14:25
在 iOS 中实现区块链
import Cocoa
import Foundation
class Block {
var index: Int = 0
var dateCreated: String
var previousHash: String!
var hash: String!
var nonce: Int
@josephchang10
josephchang10 / ReviewRequest.swift
Created August 12, 2017 05:12
从 iOS 10.3 开始请求应用商店评分的正确姿势:SKStoreReviewController
//
// ReviewRequest.swift
//
// Created by 张嘉夫 on 12/8/17.
// Copyright © 2017 张嘉夫. All rights reserved.
import Foundation
import StoreKit
let runIncrementerSetting = "numberOfRuns" // 用于存储运行次数的 UserDefauls 字典键
@Josscii
Josscii / iOS Navigation.md
Last active August 28, 2021 17:49
iOS Navigation Related Cheat Sheet

iOS Navigation Related Cheat Sheet

NavigationItem

每个 vc 都有自己的 navigationItem。

// 隐藏 push 的下一个 vc 的 back title。
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
//
// PSPDFFastEnumeration.h
// PSPDFFoundation
//
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com.
// Try it today using our free PDF Viewer app: https://pdfviewer.io/
//
// This file is MIT licensed.
@protocol PSPDFFastEnumeration <NSFastEnumeration>
@OliverLetterer
OliverLetterer / XCDUUID.m
Created January 26, 2013 17:05
With this gist, I, as a total assembly noob, am trying to understand the XCDUUID runtime hack (https://github.com/0xced/NSUUID/blob/1.0.1/NSUUID.m#L167-L221) to be able to use NSUUID on iOS < 6.0.
@implementation XCDUUID
+ (void) load
{
// query runtime if NSUUID class already exists, if so => done
if (objc_getClass("NSUUID"))
{
return;
}