x4storm 最近的时间轴更新
x4storm

x4storm

V2EX 第 93377 号会员,加入于 2015-01-23 21:20:55 +08:00
今日活跃度排名 11441
x4storm 最近回复了
1 天前
回复了 zzlit 创建的主题 程序员 求助纯 JavaScript 代码优化
原始的代码确实难读:手动 for 循环;各种 flag 用于控制循环。这些面向过程式的编程风格极大的增加了阅读难度。

以下是 AI 优化过的代码,利用 js 的函数式编程特性,可以以更易读的方式组织代码:
主要的优化点是,用 filter 和 some 代替冗长的 for 循环。这里面的 Map 确实不是必要的,如果换成 string array 的话看起来会更简单一点。

```javascript
const originArr = [
{ value: "q", children: [{ value: "w", children: [{ value: "e" }, { value: "r" }] }, { value: "t", children: [{ value: "" }, { value: "y" }, { value: "u" }] }, { value: "i" }] },
{ value: "o" },
];

const targetMap = new Map([
["q/w/e", undefined],
["q/t", undefined],
]);

function formatArr(arr, path = '') {
return arr.filter(item => {
const currentPath = path ? `${path}/${item.value}` : item.value;

// Check if the current path is needed
if (targetMap.has(currentPath)) {
return true;
}

// Check if any target path starts with the current path
const isPrefix = Array.from(targetMap.keys()).some(key => key.startsWith(currentPath));
if (!isPrefix) {
return false;
}

// Recursively filter children if they exist
if (item.children) {
item.children = formatArr(item.children, currentPath);
}

return true;
});
}

const copyArr = formatArr(JSON.parse(JSON.stringify(originArr)));
console.log(originArr, copyArr);
```
206 天前
回复了 uaoao12g 创建的主题 信息安全 求推荐,防关联,指纹浏览器。
@ik 看来楼主确实不知道 profile 功能的实际情况,除了 ip 其他都满足。profile 就相当于操作系统的多用户,不同的 profile 相关文件是分开存储的,新开的 profile 是全新的环境,可以安装不同的扩展,登录不同的 google 帐号,这些都会产生不同的指纹。
隐私窗口会有 cookie 严格限制的问题,现在我们的 QA 测试不同帐号都是用不同 profile 来测的。

![Image in GitHub]( https://github.com/yisibl/resvg-js/assets/4338052/20f9d8af-238a-4277-8551-d116bcf6a2d0)
214 天前
回复了 uaoao12g 创建的主题 信息安全 求推荐,防关联,指纹浏览器。
chrome 开不同的 profile 就可以
所以有谁哪天发发善心,毁灭掉这个糟糕的世界吗?
237 天前
回复了 jlak 创建的主题 问与答 为什么 hetzner 这么便宜?有什么坑吗
我用的 contabo 基础套餐 2C 4G 也是 4 刀起步,看了下这两家都是德国的,难道这是原因之一?
https://contabo.com/en/vps/
237 天前
回复了 Ethkuil 创建的主题 Windows Edge 怎么这么犯贱啊??
mac 上的 Edge 挺不错的,设置后可以达到类似 Arc 浏览器的效果。
至于 Chrome 也在不断加侧边栏的各种功能,落后于主流的功能,应该只剩垂直标签栏没有加了。
> 企业愿意花钱的,一定是跟业务匹配度高的,满足这几个预期:第一是立马提高业绩,第二是安全合规不得不买,第三是有增值服务。效率协同,一定是排在最后一位的
引用自少数派 https://sspai.com/post/82238
248 天前
回复了 ihehe 创建的主题 程序员 我也出一个域名 zao.pw,明牌 900
run.ci 做 devops 很合适
269 天前
回复了 sloknyyz 创建的主题 程序员 10k+ star 的项目也搞假开源
最初当作开源宣传的,v 站上自己就有 https://www.v2ex.com/t/918383 ,然后新的私有项目占了老项目的名字,确实有点问题。

不过现在新的 repo 的 readme 已经改了,不会再造成误导了。之前还是会误导人的。
甚至找不到 cancel plan 的地方,openai 的 help 页面说可以点击 cancel plan 按钮,但是我没看到。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1383 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 17:46 · PVG 01:46 · LAX 10:46 · JFK 13:46
Developed with CodeLauncher
♥ Do have faith in what you're doing.