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
| /* | |
| * ESLint的JSON文件是允许JavaScript注释的,但在gist里显示效果不好,所以我把.json文件后缀改为了.js | |
| */ | |
| /* | |
| * ESLint 配置文件优先级: | |
| * .eslintrc.js(输出一个配置对象) | |
| * .eslintrc.yaml | |
| * .eslintrc.yml |
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 <TargetConditionals.h> | |
| #ifdef __OBJC_GC__ | |
| #error SDWebImage does not support Objective-C Garbage Collection | |
| #endif | |
| // Seems like TARGET_OS_MAC is always defined (on all platforms). | |
| // To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8 | |
| #if TARGET_OS_OSX | |
| #define SD_MAC 1 |
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
| 1. 主线程安全执行- source:SDWebImage | |
| dispatch_main_async_safe | |
| #ifndef dispatch_main_async_safe | |
| #define dispatch_main_async_safe(block)\ | |
| if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ | |
| block();\ | |
| } else {\ | |
| dispatch_async(dispatch_get_main_queue(), block);\ | |
| } |
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
| [textField setValue:[UIFont systemFontOfSize:25.0] forKeyPath:@"_placeholderLabel.font"]; | |
| 获取空间内部属性: | |
| unsigned int count = 0; | |
| objc_property_t *properties = class_copyPropertyList([UITextField class], &count); | |
| for (int i = 0; i < count; i++) { | |
| objc_property_t property = properties[i]; | |
| const char *name = property_getName(property); | |
| NSLog(@"name:%s",name); | |
| } |
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
| # Type a script or drag a script file from your workspace to insert its path. | |
| # Sets the target folders and the final framework product. | |
| # 如果工程名称和Framework的Target名称不一样的话,要自定义FMKNAME | |
| # 例如: FMK_NAME = "MyFramework" | |
| FMK_NAME=${PROJECT_NAME} | |
| # Install dir will be the final output to the framework. | |
| # The following line create it in the root folder of the current project. | |
| INSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework | |
| # Working dir will be deleted after the framework creation. |
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
| NSString *backGroundColorSource = @"document.body.style.background = \"#ffffff\""; | |
| WKUserScript *backGroundColorUserScript = [[WKUserScript alloc] initWithSource:backGroundColorSource injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; | |
| WKUserContentController *userController = [[WKUserContentController alloc] init]; | |
| [userController addUserScript:backGroundColorUserScript]; | |
| WKPreferences *preference = [[WKPreferences alloc] init]; | |
| preference.minimumFontSize = 25; | |
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
| 规则大概描述如下 | |
| 通配符支持,如 *.example.com/* 实际书写时可省略 * 如 .example.com/ 意即 *.example.com/* | |
| 正则表达式支持,以\开始和结束, 如 [\w]+://example.com\ | |
| 例外规则 @@,如 @@.example.com/ 满足@@后规则的地址不使用代理 | |
| 匹配地址开始和结尾 |,如 |http://example.com、example.com| 分别表示以 http://example.com 开始和以 example.com 结束的地址 | |
| || 标记,如 ||example.com 则 http://example.com 、example.com 、ftp://example.com 等地址均满足条件,只用于匹配地址开头 | |
| 注释 ! 如 ! Comment | |
| 分隔符^,表示除了字母、数字或者 _ - . % 之外的任何字符。如 http://example.com^ ,http://example.com 和 http://example.com:8000 均满足条件,而 http://example.com.ar 不满足条件 | |
| 如何使用自定义规则 |
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
| - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | |
| if (!self.isUserInteractionEnabled || self.isHidden || self.alpha <= 0.01) return nil; | |
| CGFloat inset = 45.0f - 78.0f; | |
| CGRect touchRect = CGRectInset(self.bounds, inset, inset); | |
| if (CGRectContainsPoint(touchRect, point)) { | |
| for (UIView *subview in [self.subviews reverseObjectEnumerator]) { | |
| CGPoint convertedPoint = [subview convertPoint:point fromView:self]; | |
| UIView *hitTestView = [subview hitTest:convertedPoint withEvent:event]; |
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
| As a local variable: | |
| returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...}; | |
| As a property: | |
| @property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes); | |
| As a method parameter: | |
| - (void)someMethodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName; |
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
| https://www.yiibai.com/sql/sql-having.html | |
| Where和Having的异同 | |
| (1)where是查询返回结果之前进行过滤的 | |
| (2)having是查询返回结果之后,对结果进行过滤的 | |
| (3)在SQL中增加 HAVING 子句原因是,where关键字无法与聚合函数一起使用,having子句常跟group by一同使用,过滤分组后的数据 |
NewerOlder