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
function getStrCharCode(str){ | |
str = `${(str||'')}`; | |
for(let i=0,len=str.length; i<len; i++){ | |
console.log({idx: i, char: `${str[i]}`, charCode: `0x${str.charCodeAt(i).toString(16)}`}); | |
} | |
}; |
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
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf | |
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
# Version 2.0 | |
[General] | |
# 日志等级: warning, notify, info, verbose (默认值: notify) | |
loglevel = notify | |
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS | |
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 | |
# 设置中.) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// self pac for ss. | |
// 2015/07/29 | |
var proxy = "__PROXY__"; | |
var direct = 'DIRECT;'; | |
var _rules = [ | |
'live.com', | |
'google.com', |
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
function quicksort(arr){ | |
if(arr.length){ | |
var x = arr.shift(), | |
smallersort = quicksort(arr.filter(function (item){ | |
return item<x; | |
})), | |
biggersort = quicksort(arr.filter(function (item){ | |
return item>=x; | |
})); | |
return smallersort.concat([x],biggersort); |
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
function findArrayChange(arrayA, arrayB){ | |
var iterator = 0, i = 0, len = 0, _r = false; | |
// _r 中存放的是 insert after 的元素的 _id_ | |
// return false 就 over 啦 | |
for (i=0,len = arrayA.length; i<len; i++){ | |
if(arrayA[i] !== arrayB[i]){ | |
if(arrayA[i] !== arrayB[i+1] && arrayA[i+1] === arrayB[i]){ | |
// A(i) != B(i+1) && A(i+1) != B(i) | |
// 循环策略是找寻 A(i) 移动到了 B(n) |
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
private function treeRecursion($array,$cid){ | |
$html = ''; | |
$hasValue = false; | |
if(isset($array)){ | |
foreach ($array as $key => $value) { | |
# code... | |
// echo "<br/>"; | |
$id = $value->get('id'); | |
$pid = $value->get('faculty'); |
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
function schonfinkelize(fn){ | |
var slice = Array.prototype.slice, | |
stored_args = slice.call(arguments, 1); | |
return function(){ | |
var new_args = slice.call(arguments), | |
args = stored_args.concat(new_args); | |
return fn.apply(null,args); | |
}; |