avatar
Articles
25
Tags
1
Categories
0
Home
Archives
Huck's dev blog
Search
Home
Archives

Huck's dev blog

enable CORS support in Chrome on Mac
Created2025-05-02
BackgroundCORS (Cross-Origin Resource Sharing) is a security feature implemented in modern web browsers. It restricts web pages from making requests to a domain different from the one that served the original page. This mechanism protects users from malicious scripts attempting to access sensitive information across sites. However, during local development or API testing, CORS can sometimes block legitimate requests. In such cases, it may be helpful to temporarily disable CORS restrictions...
npm install config
Created2025-02-20
After installing npm, I wanted to install http-server, but I got an error saying: the reason is that node_module directroy is in a protected directory. Apple Support: System Integrity Protection There are three ways to solve this problem: Use sudo to install (not recommended) Turn off SIP (not recommended) Manually change npm’s default directories (suggested) Using sudo to install will override system files. If a package contains malicious code, using sudo grants the code full system...
Tapbit 合约页面性能报告
Created2025-01-06
报告概述1 背景检查 Tapbit 合约页面的性能,寻找是否有可优化的地方浏览器:Mac 上的 Chrome,版本 131.0.6778.205 (Official Build) (arm64)设备:MacBook Air M3 2 当前性能指标使用工具(WebPageTest 和隐身模式下的 LightHouse)获取 Binance、OKX 和 Tapbit 的性能指标 Binance OKX Tapbit 性能评分 91 92 67 SSR 是 是 否 页面地址:https://www.tapbit.com/contract/futures/BTC-SWAP在线结果:https://www.webpagetest.org/result/250103_AiDcE7_FE/ 为什么 SSR(服务器端渲染)的性能评分比 CSR(客户端渲染)更高?答案将在博客结尾解释。 在接下来的部分中,我们将使用本地 LightHouse 数据分析 Tapbit。 首次内容绘制 (FCP) :(页面上第一个文本或图像被绘制)2.3 秒...
Performance Report for Tapbit BTC Contract Page
Created2025-01-03
Report Overview1 backgroundcheck the performance of tapbit futures pages ,to see if there is anything can be optmizedbrowser : chrome on mac Version 131.0.6778.205 (Official Build) (arm64)device : macbook Air M3 2 Current performance indicatorsusing the tool(WebPageTest and LightHouse in incognito mode)to get the metrics result of binance ,okx and tapbit binance okx tapbit performance 91 92 67 SSR YES YES NOT url: https://www.tapbit.com/contract/futures/BTC-SWAPonline result...
How large should a JS file be
Created2025-01-02
In a mobile-first world, ensuring fast JavaScript loading is critical for providing a seamless user experience. When using mobile or 4G networks, a 300 KB JavaScript file can theoretically be downloaded within 1 second, assuming a bandwidth of 2 Mbps. Here’s how the calculation works: Bandwidth Conversion:2 Mbps = 2048 Kbps 2Mbps = 2 * 1024 Kbps = 2048 Kbps ≈ 256 KB/sThis means 256 KB/s of data can be downloaded per second. Download Time:300 KB ÷ 256 KB/s ≈...
two common use of closure
Created2024-11-17
there are two common use of closure: pass function as parameter,pass function as return value pass function as parameter12345678910function a1(){ let a = 100; return function(){ console.log(a) }}let a = 200;let b = a1()b();// output 100; Explanation:In this example, the function a1 defines a local variable a (with a value of 100) and returns an inner function. The inner function forms a closure over a. When b is executed, it remembers the environment...
protoType and protoType Chain
Created2024-11-16
there is simple question how can you check if a variable is an Array。the answer is easy 1arr instanceof Array if result is true ,arr is Array .otherwise arr isn’t; so there is another question: what’s principle behind instanceof in Javascript let me explain there’re two classes. People and Student . Student implements People 123456789101112131415161718class People{ constructor(name){ this.name = name } eat(){ console.log(`${this.name}...
When to Use === and ==
Created2024-11-13
Use the == operator only when checking for null or undefined. In all other cases, use === for strict equality.For example: 12if(obj.a == null){} is equivalent to: 12if (obj.a === null || obj.a === undefined) {}
Implement deepClone manually
Created2024-11-13
Reason:Reference types will share the same address, so when we use = operator, if there is modification on the new object, the value on the old object will change too. SolutionIterate the Object recursively. If there is reference type, we create a new one and copy all the value type to the new reference type. 12345678910111213141516171819202122232425262728function deepClone(obj = {}) { // null can't be treated as object if (typeof obj != "object"...
decode message
Created2024-03-26
There is a interview question on bfe.dev about decode-message. The link is below https://bigfrontend.dev/problem/decode-message Your are given a 2-D array of characters. There is a hidden message in it. 123I B C A L K AD R F C A E AG H O E L A D col and row are marked with number which start from 0. The number of col is 0 ~ 6 ,and the number of row is 0~2The way to collect the message is as follows start at top left move diagonally down right when cannot move any more, try to switch to...
123
avatar
huck@love
Articles
25
Tags
1
Categories
0
Follow Me
Announcement
This is my Blog
Recent Posts
enable CORS support in Chrome on Mac2025-05-02
npm install config2025-02-20
Tapbit 合约页面性能报告2025-01-06
Performance Report for Tapbit BTC Contract Page2025-01-03
How large should a JS file be2025-01-02
Tags
CORS, Chrome, macOS, Web Development
Archives
  • May 2025 1
  • February 2025 1
  • January 2025 3
  • November 2024 4
  • March 2024 1
  • February 2024 3
  • January 2024 12
Website Info
Article Count :
25
Unique Visitors :
Page Views :
Last Update :
©2019 - 2025 By huck@love
Framework Hexo|Theme Butterfly
Search
Loading Database