Skip to content

Instantly share code, notes, and snippets.

JasonY iJasonY

View GitHub Profile
@Skifary
Skifary / main.m
Last active Jul 3, 2020
修改block的实现,先打印参数,再输出原有实现
View main.m
#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 Jul 3, 2020
替换block原有实现
View main.m
#import <Foundation/Foundation.h>
typedef struct __block_impl {
void *isa;
int Flags;
int Reserved;
void *FuncPtr;
}__block_impl;
typedef void(^GlobalBlock)(void);
@OliverLetterer
OliverLetterer / XCDUUID.m
Created Jan 26, 2013
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.
View XCDUUID.m
@implementation XCDUUID
+ (void) load
{
// query runtime if NSUUID class already exists, if so => done
if (objc_getClass("NSUUID"))
{
return;
}
View PSPDFFastEnumeration.h
//
// 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>
@josephchang10
josephchang10 / blockchain.swift
Created Dec 27, 2017
在 iOS 中实现区块链
View blockchain.swift
import Cocoa
import Foundation
class Block {
var index: Int = 0
var dateCreated: String
var previousHash: String!
var hash: String!
var nonce: Int
@Josscii
Josscii / iOS Navigation.md
Last active Apr 29, 2018
iOS Navigation Related Cheat Sheet
View iOS Navigation.md

iOS Navigation Related Cheat Sheet

NavigationItem

每个 vc 都有自己的 navigationItem。

// 隐藏 push 的下一个 vc 的 back title。
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
@josephchang10
josephchang10 / ReviewRequest.swift
Created Aug 12, 2017
从 iOS 10.3 开始请求应用商店评分的正确姿势:SKStoreReviewController
View ReviewRequest.swift
//
// ReviewRequest.swift
//
// Created by 张嘉夫 on 12/8/17.
// Copyright © 2017 张嘉夫. All rights reserved.
import Foundation
import StoreKit
let runIncrementerSetting = "numberOfRuns" // 用于存储运行次数的 UserDefauls 字典键
You can’t perform that action at this time.