Skip to content

Instantly share code, notes, and snippets.

View songxing10000's full-sized avatar

xingsong songxing10000

  • ChengDu
View GitHub Profile
#define kClassKey @"rootVCClassString"
#define kTitleKey @"title"
#define kImgKey @"imageName"
#define kSelImgKey @"selectedImageName"
- (void)viewDidLoad {
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeNone;
@songxing10000
songxing10000 / UIViewController+Hook.h
Created November 11, 2016 16:05
viewDidAppear打印当前页面类名,dealloc时打印销毁画页,看是否有离开未销毁可能存在内存泄漏的页面
#import <UIKit/UIKit.h>
/**
viewDidAppear打印当前页面类名,dealloc时打印销毁画页,看是否有离开未销毁可能存在内存泄漏的页面
*/
@interface UIViewController (Hook)
@end
@songxing10000
songxing10000 / UILabel+lineSpacing.m
Last active February 22, 2017 02:00
UILabel行间距
NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:self.illLabel.text];
NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle1 setLineSpacing:50.0];
[attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [self.illLabel.text length])];
[self.illLabel setAttributedText:attributedString1];
@songxing10000
songxing10000 / RSAEncryptor.h
Last active February 22, 2017 01:59
private_key.p12 public_key.der
#import <Foundation/Foundation.h>
@interface RSAEncryptor : NSObject
/**
* 加密方法
*
* @param str 需要加密的字符串
* @param path '.der'格式的公钥文件路径
*/
@songxing10000
songxing10000 / RSAEncryptor.m
Created February 22, 2017 01:59
private_key.p12 public_key.der
#import "RSAEncryptor.h"
#import <Security/Security.h>
@implementation RSAEncryptor
static NSString *base64_encode_data(NSData *data){
data = [data base64EncodedDataWithOptions:0];
NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return ret;
}
[BaseService postJSONWithUrl:APP_URL parameters:nil success:^(id responseObject)
{
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil removingNulls:YES ignoreArrays:NO];
NSArray *infoArray = [dic objectForKey:@"results"];
if ([infoArray count])
{
NSDictionary *releaseInfo = [infoArray objectAtIndex:0];
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *currentVersion = [[infoDic objectForKey:@"CFBundleShortVersionString"] stringByReplacingOccurrencesOfString:@"." withString:@""];
NSString *lastVersion = [[releaseInfo objectForKey:@"version"] stringByReplacingOccurrencesOfString:@"." withString:@""];
@interface AdViewController ()
/** 定时器 */
@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic, strong) UIButton *adButton;
@end
@implementation AdViewController
NSUInteger secondsCountDown = 3;//倒计时秒数
@songxing10000
songxing10000 / openOrCloseApp
Created September 13, 2017 16:04
openOrCloseApp
tell application "System Events"
get name of every process whose name is "企业微信"
if result is not {} then
tell application "企业微信"
quit
end tell
@songxing10000
songxing10000 / 自动点击企业微信界面的登录按钮
Created September 13, 2017 16:05
自动点击企业微信界面的登录按钮
tell application "System Events"
tell application "企业微信"
activate
end tell
if not (exists (button "登录" of window 1 of application process "企业微信" of application "System Events")) then
tell application "企业微信"
quit
end tell
@songxing10000
songxing10000 / 获取app窗口所有控件
Created September 13, 2017 16:05
获取app窗口所有控件
tell application "System Events"
tell application "企业微信"
activate
tell application "System Events"
tell process "企业微信"
get entire contents of window 1
end tell
end tell
end tell