Skip to content

Instantly share code, notes, and snippets.

View zhoufenfens's full-sized avatar
:bowtie:
i am working

zhou zhoufenfens

:bowtie:
i am working
View GitHub Profile
@zhoufenfens
zhoufenfens / koa.middleware.js
Created January 12, 2024 12:39
koa中间件
const middleware = []
let mw1 = async function (ctx, next) {
console.log("next前,第一个中间件", new Date().getTime())
await next()
console.log("next后,第一个中间件", new Date().getTime())
}
let mw2 = async function (ctx, next) {
console.log("next前,第二个中间件", new Date().getTime())
await next()
console.log("next后,第二个中间件", new Date().getTime())
@zhoufenfens
zhoufenfens / asap.js
Last active August 7, 2020 17:18
尽快输出
const asyncFun = (i, cb) => {
setTimeout(() => {
let result = 2 * i
cb(result)
}, Math.random() * 1000);
}
const results = []
var rIndex = 1
var removeNthFromEnd = function(head, n) {
let target = head,
cur = head;
while (n--) {
cur = cur.next;
}
while (cur && cur.next) {
cur = cur.next;
target = target.next;
}
class TrieNode{
TrieNode[] child;//记录孩子节点
boolean is_end;//记录当前节点是不是一个单词的结束字母
public TrieNode(){//
child = new TrieNode[26];//子节点数组长度26,0:‘a’,1:‘b’.....
is_end = false;
}
}
class Trie {
// if (window.location.hostname === 'localhost') {
// // 测试环境
// let el = document.querySelectorAll('[data-sdkdom=phone]')[0];
// el.value = '18515904047';
// var e = document.createEvent('HTMLEvents');
// e.initEvent('input', false, true);
// el.dispatchEvent(e);
// }
@zhoufenfens
zhoufenfens / charles.txt
Created October 14, 2019 08:33
charles
Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
function string10to62(number) {
var chars = '0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ'.split(''),
radix = chars.length,
qutient = +number,
arr = [];
do {
mod = qutient % radix;
qutient = (qutient - mod) / radix;
arr.unshift(chars[mod]);
} while (qutient);
@zhoufenfens
zhoufenfens / tree.java
Created March 30, 2019 16:45
二叉树bfs
void PrintNodeByLevel(Node *root)
{
int parentSize = 1, childSize = 0;
Node * temp;
queue<Node *> q;
q.push(root);
do
{
temp = q.front();
/* set the width and height */
::-webkit-scrollbar {
width: 14px;
height: 6px;
}
/* turn on the buttons at the top */
::-webkit-scrollbar-button:start{
display: block;
}
<ul>
<li ne-repeat="item in list" id="{{'type_two_' + __i}}">
{{item.title}}
</li>
</ul>