Skip to content

Instantly share code, notes, and snippets.

View zhaozzq's full-sized avatar
😜
I may be slow to respond.

Zhao zhaozzq

😜
I may be slow to respond.
View GitHub Profile
@zhaozzq
zhaozzq / inject.markdown
Last active October 16, 2024 01:41
Inject js to WKWebView
WKWebViewConfiguration *configuration = [WKWebViewConfiguration new];
NSString *eruda = @"(function () { var script = document.createElement('script'); script.src='//cdn.jsdelivr.net/npm/eruda'; document.body.appendChild(script); script.onload = function () { eruda.init() } })();";
WKUserScript *script = [[WKUserScript alloc] initWithSource:eruda injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO];
[configuration.userContentController addUserScript:script];
_webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];

or

NSString *jsPath = [[NSBundle mainBundle] pathForResource:@"vConsole" ofType:@"js"];
  • 添加 origin
git remote add origin path/to/repository
  • If you want to merge project-a into project-b:
cd path/to/project-b
git remote add project-a path/to/project-a
git fetch project-a
git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge
@zhaozzq
zhaozzq / 打电话
Last active July 10, 2017 06:48
Generated by Xgist (https://github.com/Bunn/Xgist) at 2017年7月10日 下午2:45:32
+ (void)callNumber:(NSString *)number
{
NSURL *tel = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",number]];
if (OSLeastIOS10) {
[[UIApplication sharedApplication] openURL:tel options:@{} completionHandler:nil];
}else{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[[UIApplication sharedApplication] openURL:tel];
#pragma clang diagnostic pop
@zhaozzq
zhaozzq / UIView+ZQPlus.h
Created April 1, 2017 03:53
UIView Category
#import <UIKit/UIKit.h>
@interface UIView (ZQPlus)
@property (assign, nonatomic) CGFloat x;
@property (assign, nonatomic) CGFloat y;
@property (assign, nonatomic) CGFloat width;
@property (assign, nonatomic) CGFloat height;
@property (assign, nonatomic) CGSize size;
- (void)addGradientLayerWithColors:(NSArray *)cgColorArray locations:(NSArray *)floatNumArray startPoint:(CGPoint )startPoint endPoint:(CGPoint)endPoint;