摘要: On mobile device, when you open / close the keyboard, zoom in / out, it might affect the visual viewport view (the actual page content); to detect cha 阅读全文
posted @ 2023-05-24 17:53 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑
摘要: React set the ref to null in runtime. It is a limitation now for react. import { useRef } from 'react'; export const Component = () => { const ref = u 阅读全文
posted @ 2023-05-24 15:11 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑
摘要: `Option` and `Result` are two very central enums in Rust, and they are used for error handling and for representing the absence of a value. Here is a 阅读全文
posted @ 2023-05-24 13:57 Zhentiw 阅读(65) 评论(0) 推荐(0) 编辑
摘要: Typescript: import fs from "fs"; const fileName = process.argv[2]; if (fileName) { fs.readFileSync(fileName) .toString() .split("\n") .map((num) => pa 阅读全文
posted @ 2023-05-24 13:52 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要: Typescript: function practice(nums: number[], index: number): number { return (nums[index] ?? index) * 5 } In Rust: fn practice(nums: Vec<usize>, inde 阅读全文
posted @ 2023-05-24 01:24 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑