This file contains 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> | |
@class RTRouter; | |
typedef void(^RTRouteCompleteBlock)(void); | |
@protocol RTRoutable <NSObject> | |
@optional | |
+ (BOOL)routerDidRoutePattern:(NSString *)pattern | |
withParameters:(id)parameters |
This file contains 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
- (UIImage *)mz_convertToSRGBColorSpace | |
{ | |
UIImage *newImage = self; | |
do { | |
CGImageRef CGImage = self.CGImage; | |
CGColorSpaceRef srcSpace = CGImageGetColorSpace(CGImage); | |
CGColorSpaceRef dstSpace = IS_IOS_9 ? CGColorSpaceCreateWithName(kCGColorSpaceSRGB) : CGColorSpaceCreateDeviceRGB(); | |
// 颜色空间一样直接返回 self | |
if (CFEqual(srcSpace, CFAutorelease(CGColorSpaceCreateDeviceRGB())) || |
This file contains 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
#define __mz_macro_concat(A, B) __mz_macro_concat_(A, B) | |
#define __mz_macro_argcount(...) __mz_macro_at(6, __VA_ARGS__, 6, 5, 4, 3, 2, 1) | |
#define __mz_macro_head(...) __mz_macro_head_(__VA_ARGS__, 0) | |
#define __mz_macro_at(N, ...) __mz_macro_concat(__mz_macro_at, N)(__VA_ARGS__) | |
#define __mz_macro_at0(...) __mz_macro_head(__VA_ARGS__) | |
#define __mz_macro_at1(_0, ...) __mz_macro_head(__VA_ARGS__) | |
#define __mz_macro_at2(_0, _1, ...) __mz_macro_head(__VA_ARGS__) | |
#define __mz_macro_at3(_0, _1, _2, ...) __mz_macro_head(__VA_ARGS__) | |
#define __mz_macro_at4(_0, _1, _2, _3, ...) __mz_macro_head(__VA_ARGS__) |
This file contains 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 NSString (ComposedCharacter) | |
/** | |
* @description @b NSString use UTF-16 encode to store characters internally, in | |
* most cast, the @c length of a @b NSString is the number visible characters. | |
* But not for some special Characters like Emoji. | |
* @"😃🤡⛹🏿♀️⚫️🤥🤕💪🏾" this @b NSString only has 7 Emojis, but its @c length is | |
* 20. Sometimes we only want the human visible charater count. | |
* | |
* @code |
This file contains 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
#define RTObjectKeyPath(OBJ, PATH) (((void)(NO && ((void)(((typeof(OBJ))nil).PATH), NO)), @# PATH)) |
This file contains 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
+ (UIImage *)rt_borderImageWithBorderColor:(UIColor *)borderColor fillColor:(UIColor *)fillColor borderWidth:(CGFloat)width radius:(CGFloat)radius forCorner:(UIRectCorner)corner | |
{ | |
const CGFloat length = MAX(3, 2 * MAX(radius, width / 2) + width + 1.f / [UIScreen mainScreen].scale); | |
UIGraphicsBeginImageContextWithOptions(CGSizeMake(length, length), NO, 0); | |
[borderColor ?: [UIColor clearColor] setStroke]; | |
[fillColor ?: [UIColor clearColor] setFill]; | |
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(width / 2, width / 2, length - width, length - width) | |
byRoundingCorners:corner | |
cornerRadii:CGSizeMake(radius, radius)]; |
This file contains 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 NSString (RegExp) | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wstrict-prototypes" | |
- (NSString *)reg_replace:(NSRegularExpression *)regexp withBlock:(NSString *(NS_NOESCAPE ^)())block; | |
- (NSString *)reg_replacePattern:(NSString *)pattern withBlock:(NSString *(NS_NOESCAPE ^)())block; | |
#pragma clang diagnostic pop | |
@end |
This file contains 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
#ifndef REGEXP | |
# define _regexp_stringify(x) #x | |
# define _regexp_stringify2(x) _regexp_stringify(x) | |
# define _regexp(...) ({ const char *str = _regexp_stringify2(# __VA_ARGS__); const size_t length = strlen(str); [[NSString alloc] initWithBytes:str + 1 length:length - 2 encoding:NSUTF8StringEncoding]; }) | |
# define REGEXP(...) [NSRegularExpression regularExpressionWithPattern:_regexp(__VA_ARGS__) options:0 error:NULL] | |
#endif |
This file contains 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
menuentry "****" { | |
linux /xxxxx consoleblank=5 | |
} |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<caml xmlns="http://www.apple.com/CoreAnimation/1.0"> | |
<CALayer allowsEdgeAntialiasing="1" allowsGroupOpacity="1" bounds="0 0 18 18" contentsFormat="RGBA8" name="Root Layer" position="9 9" transform=""> | |
<sublayers> | |
<CAShapeLayer id="#4" fillColor="1 1 1" path="0.26367188 0.7418073 m 5.57226563 6.83714 l 5.78320313 7.060576 6.1171875 7.060576 6.31933594 6.83714 c 11.62792968 0.7418073 l 11.90039068 0.4468719 11.73339848 0 11.32031248 0 c 0.57128907 0 l 0.16699219 0 0 0.4468719 0.26367188 0.7418073 c h" allowsEdgeAntialiasing="1" allowsGroupOpacity="1" bounds="0 0 11.90039068 7.060576" contentsFormat="RGBA8" name="triangle" position="8.99121096 4.030288"> | |
<scriptComponents/> | |
</CAShapeLayer> | |
<CALayer allowsEdgeAntialiasing="1" allowsGroupOpacity="1" bounds="0 0 18 18" contentsFormat="RGBA8" name="rings" position="9 9"> | |
<mask allowsEdgeAntialiasing="1" allowsGroupOpacity="1" backgroundColor="0 0 0" bounds="0 0 18 18" contentsFormat="RGBA8" name="mas |
OlderNewer