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 "ReleaseViewController.h" | |
void testStrongRelease0(void) ; | |
void testStrongRelease1(void) ; | |
void testStrongRelease2(void) ; | |
#define MNJSpaceLog() do { NSLog(@"\n\n");} while(0) | |
@interface MNJObject : NSObject | |
+ (instancetype)object; |
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
// 比较字符串是否在数组中, 忽略大小写 参考 https://segmentfault.com/a/1190000000623005 | |
NSPredicate *p = [NSPredicate predicateWithFormat:@"SELF ==[cd] %@",self]; | |
NSArray *r = [strings filteredArrayUsingPredicate:p]; | |
return r.count > 0; |
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
/<(?:.|\s)*?>/g | |
/** | |
example | |
'<span class='at-member'>@manajay</span> hello world!'.replace(/<(?:.|\s)*?>/g, '') | |
==> '@manajay hello world!' | |
*/ |
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
@"((http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(www.[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)"; |
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
// | |
// LSBundleUtil.m | |
// Pods | |
// | |
// Created by ljtwan on 2018/10/9. | |
// | |
#import "LSBundleUtil.h" | |
@implementation LSBundleUtil |
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
# -*- coding: UTF-8 -*- | |
#!/usr/bin/python | |
import sys, getopt | |
# gz: 即gzip。通常仅仅能压缩一个文件。与tar结合起来就能够实现先打包,再压缩。 | |
# | |
# tar: linux系统下的打包工具。仅仅打包。不压缩 | |
# | |
# tgz:即tar.gz。先用tar打包,然后再用gz压缩得到的文件 |
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
// | |
// UILabel+LSFrame.m | |
// iLawSchool | |
// | |
// Created by ljtwan on 2018/8/30. | |
// Copyright © 2018 iCourt. All rights reserved. | |
// | |
#import "UILabel+LSFrame.h" | |
#import <CoreText/CoreText.h> |
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 *)createRoundedCornerImageWithRadius:(CGFloat)radius outerSize:(CGSize)outerSize innerSize:(CGSize)innerSize fillColor:(UIColor *)fillColor { | |
UIGraphicsBeginImageContextWithOptions(outerSize, false, [UIScreen mainScreen].scale); | |
CGContextRef currentContext = UIGraphicsGetCurrentContext(); | |
UIBezierPath *bezierPath = [[UIBezierPath alloc] init]; | |
CGFloat xOffset = (outerSize.width - innerSize.width) / 2; | |
CGFloat yOffset = (outerSize.height - innerSize.height) / 2; | |
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*)lj_imageAddCornerWithRadius:(CGFloat)radius byRoundingCorners:(UIRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor imageSize:(CGSize)size { | |
// 1. 创建一个画布 | |
CGRect rect = CGRectMake(0, 0, size.width, size.height); | |
UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale); | |
// 2. 获取图形上下文 | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
// 3. 计算 path 圆角 | |
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)]; | |
CGContextAddPath(ctx,path.CGPath); |
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
+ (void)ls_methodSwizzlingWithOriginalSelector:(SEL)originalSelector swizzledSelector:(SEL)swizzledSelector { | |
Class class = [self class]; | |
Method originalMethod = class_getInstanceMethod(class, originalSelector); | |
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); | |
// When swizzling a class method, use the following: | |
// Class class = object_getClass((id)self); | |
// ... | |
// Method originalMethod = class_getClassMethod(class, originalSelector); |
NewerOlder