This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SwiftFormat config compliant with Google Swift Guideline | |
# https://google.github.io/swift/#control-flow-statements | |
# Specify version used in a project | |
--swiftversion 5.10 | |
# Rules explicitly required by the guideline | |
--rules \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config path: '~/.config/alacritty/alacritty.toml' | |
live_config_reload = true | |
[colors] | |
draw_bold_text_with_bright_colors = true | |
[colors.bright] | |
black = "#625e4c" | |
blue = "#9d65ff" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- config path: '~/.config/wezterm/wezterm.lua' | |
local wezterm = require('wezterm') | |
local config = {} | |
if wezterm.config_builder then | |
config = wezterm.config_builder() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MARK:- 超出作用域后执行 | |
//defer(swift延迟调用关键字)宏 (http://blog.sunnyxx.com/2014/09/15/objc-attribute-cleanup/ ) | |
/// 出了作用域时执行block,类似于swift中的defer和EXTScope中的onExit | |
/// | |
/// Example: | |
/// zd_defer { | |
/// /// 所谓作用域结束,包括大括号结束、return、goto、break、exception等各种情况 | |
/// NSLog(@"当前作用域结束,马上要出作用域了"); | |
/// }; | |
/// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)dismiss | |
{ | |
[CATransaction begin]; | |
CATransition *transition = [CATransition animation]; | |
transition.type = kCATransitionReveal; | |
transition.subtype = kCATransitionFromTop; | |
transition.duration = 0.25f; | |
transition.fillMode = kCAFillModeForwards; | |
transition.removedOnCompletion = YES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSTimer (ZDUtility) | |
+ (NSTimer *)zd_scheduledTimerWithTimeInterval:(NSTimeInterval)seconds | |
block:(void (^)(NSTimer *timer))block | |
repeats:(BOOL)repeats; | |
+ (NSTimer *)zd_timerWithTimeInterval:(NSTimeInterval)seconds | |
block:(void (^)(NSTimer *timer))block | |
repeats:(BOOL)repeats; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSObject (ZDWeakAssociate) | |
- (void)zd_setWeakAssociateValue:(id)value forKey:(void *)key { | |
__weak id weakValue = value; | |
objc_setAssociatedObject(self, key, ^{ | |
return weakValue; | |
}, OBJC_ASSOCIATION_COPY); | |
} | |
- (id)zd_getWeakAssociateValueForKey:(void *)key { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const void *TouchExtendInsetKey = &TouchExtendInsetKey; | |
static void Swizzle(Class c, SEL orig, SEL new) { | |
Method origMethod = class_getInstanceMethod(c, orig); | |
Method newMethod = class_getInstanceMethod(c, new); | |
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){ | |
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
} | |
else { | |
method_exchangeImplementations(origMethod, newMethod); |
NewerOlder