Skip to content

Instantly share code, notes, and snippets.

View lihei12345's full-sized avatar

daqiang lihei12345

View GitHub Profile
define([],
function() {
"use strict";
function a(a) {
function c(a) {
if (!b && global.isIphone) try {
a.init(),
b = !0
} catch(c) {}
}
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
WKNavigationActionPolicy policy = WKNavigationActionPolicyAllow;
BOOL isFragmentJump = NO;
if (navigationAction.request.URL.fragment) {
NSString *nonFragmentURL = [navigationAction.request.URL wm_nonFragmentURLString];
isFragmentJump = [nonFragmentURL isEqualToString:webView.URL.absoluteString];
}
#!/usr/bin/env python
import os
path = os.path.expanduser('~') + '/Library/MobileDevice/Provisioning Profiles'
cmd_path = os.path.expanduser('~') + '/Library/MobileDevice/Provisioning\ Profiles'
provision_files = [x for x in os.listdir(path) if os.path.splitext(x)[1]==".mobileprovision"]
output_path = os.path.expanduser('~') + '/Desktop/provision_infos'
if not os.path.exists(output_path):
os.mkdir(output_path)
@lihei12345
lihei12345 / CYExecuteTimeWatcher.m
Created February 16, 2016 11:13
CYExecuteTimeWatcher
// h file
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CYExecuteTimeWatcher : NSObject
-(instancetype)init NS_UNAVAILABLE;
+ (instancetype)begin:(NSString *)tag;
@lihei12345
lihei12345 / gist:13f4ae85e900202382f9
Last active February 16, 2016 09:43
text size cache
@interface NSObject (WMCacheableTextSize)
@property (nonatomic, strong, readonly) NSMutableDictionary *wm_cacheableTextSizeCache;
- (NSNumber *)wm_cacheableSizeOfString:(NSString *)string calculateBlock:(NSNumber* (^)())block;
@end
#import "NSObject+WMCacheableTextSize.h"
@lihei12345
lihei12345 / AutoLayoutFixLabel.m
Last active August 29, 2015 14:24
fix multi-line UILabel
// iOS8之下,Auto Layout中使用多行Label的时候,需要手工设置preferredMaxLayoutWidth才能work,iOS8之后则不需要;
// 最低支持版本变为iOS8的时候,改用UILabel即可
// 1. http://stackoverflow.com/questions/25398312/automatic-preferred-max-layout-width-is-not-available-on-ios-versions-prior-to-8
// 2. http://stackoverflow.com/questions/17491376/ios-autolayout-multi-line-uilabel
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0)
@interface AutolayoutFixLabel : UILabel
@end
#endif
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0)
@lihei12345
lihei12345 / gist:3bc82ced45b267b1bc2c
Created June 20, 2015 01:03
alpha_ruby_fastlane
desc "Submit a new Beta Build to pgyer"
lane :alpha do
ensure_git_status_clean
ipa_path = "/Users/jason/Desktop/" + Time.now.strftime("%Y-%m-%d")
ipa_name = "XXX-alpha.ipa"
ipa(
workspace: "XXX.xcworkspace",
configuration: "Release",
scheme: "XXX",
# (optionals)
#!/usr/bin/env bash
source ~/.bash_profile
bundle install
bundle exec pod repo update
bundle exec pod install
ipa build -c Release -d ~/Desktop
@lihei12345
lihei12345 / gist:84a4ed83aa07a9d3a7d7
Created June 19, 2015 03:21
Jenkins_Launch_daemon_plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Jenkins</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
- (NSInvocation *)duplicateInvocation:(NSInvocation *)origInvocation
{
NSMethodSignature *methodSignature = [origInvocation methodSignature];
NSInvocation *dupInvocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[dupInvocation setSelector:[origInvocation selector]];
NSUInteger i, count = [methodSignature numberOfArguments];
for (i = 2; i < count; i++)
{