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
- (BOOL)stringContainsEmoji:(NSString *)string { | |
__block BOOL returnValue = NO; | |
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock: | |
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { | |
const unichar hs = [substring characterAtIndex:0]; | |
// surrogate pair | |
if (0xd800 <= hs && hs <= 0xdbff) { | |
if (substring.length > 1) { | |
const unichar ls = [substring characterAtIndex:1]; |
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
static UIView *PSPDFViewWithSuffix(UIView *view, NSString *classNameSuffix) { | |
if (!view || classNameSuffix.length == 0) return nil; | |
UIView *theView = nil; | |
for (__unsafe_unretained UIView *subview in view.subviews) { | |
if ([NSStringFromClass(subview.class) hasSuffix:classNameSuffix]) { | |
return subview; | |
}else { | |
if ((theView = PSPDFViewWithSuffix(subview, classNameSuffix))) break; | |
} |
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
#!/bin/sh | |
parse_yaml() { | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
awk -F$fs '{ | |
indent = length($1)/2; | |
vname[indent] = $2; | |
for (i in vname) {if (i > indent) {delete vname[i]}} |
Proxy 一般有2种协议,一种是 HTTP/HTTPS 协议,一种是 SOCKS 协议。优先使用 SOCKS 协议的 SOCKS5 版本。[2种协议的区别 待补充外部引用]
一般各平台的代理客户端除了提供一个本地的 socks5 Proxy ,还会提供一个本地的 http Proxy 。 在客户端相应设置中查看 socks5 协议监听的端口,HTTP Proxy 设置中查看 http 协议监听的端口。
注意:不少客户端提供混合模式,即
socks5
和http
端口号是同一个,所以不用费尽心思在软件设定中找单独的 http 端口设置功能了。