View tree-printer.js
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
class TreePrinter { | |
constructor() { | |
this._maxDigits = 0; | |
} | |
// BFS: https://en.wikipedia.org/wiki/Breadth-first_search | |
// empty node will be null in list | |
_getBreadthFirstList(rootNode, maxHeight) { | |
const queue = [rootNode]; | |
const list = []; |
View config.yaml
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
payload: | |
# company ban | |
- DOMAIN-SUFFIX,yinxiang.com,Proxy | |
- DOMAIN-SUFFIX,yuque.com,Proxy | |
- DOMAIN-SUFFIX,shimo.im,Proxy | |
- DOMAIN-SUFFIX,docs.qq.com,Proxy | |
# custom | |
- DOMAIN-SUFFIX,setapp.com,Proxy | |
- DOMAIN-SUFFIX,ankiweb.net,Proxy |
View subconverter-config
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
[rulesets] | |
ruleset=🎯 全球直连,clash-classic:https://gist.githubusercontent.com/clinyong/5d734fc72d0390e831c4e5279a69a9f3/raw/5a3eaa83e1c637a2356df744fb9b48bcd941e5d9/clash-pdd,86400 |
View Promise.ts
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
class Promise() { | |
constructor() { | |
} | |
} |
View event-pool.js
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
const eventPool = []; | |
const EVENT_POOL_SIZE = 10; | |
function SyntheticEvent(nativeEvent) { | |
this.nativeEvent = nativeEvent; | |
} | |
SyntheticEvent.prototype.persist = function persist() { | |
this.isPersistent = true; | |
}; |
View Transaction.js
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
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ |
View walkdir.js
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 walkDir(root) { | |
const stat = fs.statSync(root); | |
if (stat.isDirectory()) { | |
const dirs = fs.readdirSync(root).filter(item => !item.startsWith('.')); | |
let results = dirs.map(sub => walkDir(`${root}/${sub}`)); | |
return [].concat(...results); | |
} else { | |
return root; | |
} |
View arguments.js
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
var Thunk = function(fn){ | |
return function (){ | |
var args = Array.prototype.slice.call(arguments); | |
return function (callback){ | |
args.push(callback); | |
return fn.apply(this, args); | |
} | |
}; | |
}; |
View checkTS
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 | |
files=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.tsx?$") | |
if [ "$files" = "" ]; then | |
exit 0 | |
fi | |
pass=true | |
for file in ${files}; do |
View audio.js
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
var audioCtx = new AudioContext(); | |
var source = audioCtx.createBufferSource(); | |
fetch( | |
'http://7xsym0.com2.z0.glb.qiniucdn.com/%E9%82%93%E7%B4%AB%E6%A3%8B%20-%20A.I.N.Y.%2528%E7%88%B1%E4%BD%A0%2529.mp3', { | |
}) | |
.then(function(resp){ | |
resp.arrayBuffer().then(function(buffer){ | |
audioCtx.decodeAudioData(buffer, function(decodedData) { |
NewerOlder