07 2023 档案

摘要:Mistake 1: Not using the same function reference // Wrong button.addEventListener('click', () => {console.log('click')}) button.removeEventListener('c 阅读全文
posted @ 2023-07-27 15:13 Zhentiw 阅读(78) 评论(0) 推荐(0) 编辑
摘要:So it's much easier to do what we did with Docker. Run this command: docker run --interactive --tty alpine:3.10 # or, to be shorter: docker run -it al 阅读全文
posted @ 2023-07-27 14:55 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Okay, so now we've hidden the processes from Eve so Bob and Alice can engage in commerce in privacy and peace. So we're all good, right? They can no l 阅读全文
posted @ 2023-07-26 14:21 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:namespace While chroot is a pretty straightforward, namespaces and cgroups are a bit more nebulous to understand but no less important. Both of these 阅读全文
posted @ 2023-07-25 14:31 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑
摘要:When Virtual keyboard popup, we can relayout the UI element accordingly: navigator.virtualKeyboard.overlaysContent = true; navigator.virtualKeyboard.s 阅读全文
posted @ 2023-07-24 15:35 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要:It's a Linux command that allows you to set the root directory of a new process. In our container use case, we just set the root directory to be where 阅读全文
posted @ 2023-07-24 14:42 Zhentiw 阅读(46) 评论(0) 推荐(0) 编辑
摘要:// Base case // 1. Off the map // 2. Hit a wall // 3. Already visited // 4. It's the end const dirs = [ [1, 0], //top [0, 1], //right [-1, 0], //botto 阅读全文
posted @ 2023-07-22 19:21 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Run the following code, found that for get & push & pop, it is O(1) time; But for shift/unshfit, it is O(n) time. In this cases, Javascript's [], is a 阅读全文
posted @ 2023-07-20 14:34 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:z-index property arranges how an element is stacked onto other positioned elements. At times you may set a z-index property on a child element to be l 阅读全文
posted @ 2023-07-20 00:45 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:You only require a few lines of CSS to enable a dark/light mode on your website. You just need to let browsers know that your website can display corr 阅读全文
posted @ 2023-07-20 00:44 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要:This trick is inclined towards improving copy and paste experience for website users. Using user-select: all, you can enable easy text selection with 阅读全文
posted @ 2023-07-20 00:37 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:You don't have to get stuck on how the browser renders a numbered list. You can implement your own design utilizing counters(). Here's how: ul { margi 阅读全文
posted @ 2023-07-20 00:33 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要:Try throttling to a slow internet in the browser Dev tools and visit a website made up of HD images like unsplash. That's how to experience the pain o 阅读全文
posted @ 2023-07-20 00:32 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:When working with positioned elements, you often write code like this: .some-element { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } Thi 阅读全文
posted @ 2023-07-20 00:30 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑
摘要:p.intro { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; /* Truncate when no. of lines exceed 3 */ overflow: 阅读全文
posted @ 2023-07-20 00:28 Zhentiw 阅读(13) 评论(0) 推荐(0) 编辑
摘要:Using Linked list to implement a Queue. In javascript, if you want to push a item in front of an Array, it need to shift the rest of items, not good f 阅读全文
posted @ 2023-07-19 14:33 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要:const $ = () => document.querySelector.call(this, arguments); const $$ = () => document.querySelectorAll.call(this, arguments); HTMLElement.prototype. 阅读全文
posted @ 2023-07-18 20:41 Zhentiw 阅读(22) 评论(0) 推荐(0) 编辑
摘要:Implement the util type OptionalUndefined<T, Props> that turns all the properties of T that can be undefined, into optional properties. In addition, a 阅读全文
posted @ 2023-07-18 19:58 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:Given a number N, find the Nth triangular number, i.e. 1 + 2 + 3 + ... + N /* _____________ Your Code Here _____________ */ export type NumberToArray< 阅读全文
posted @ 2023-07-18 19:47 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Given 2 sets (unions), return its Cartesian product in a set of tuples, e.g. CartesianProduct<1 | 2, 'a' | 'b'> // [1, 'a'] | [2, 'a'] | [1, 'b'] | [2 阅读全文
posted @ 2023-07-18 19:22 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑
摘要:Solution 1: consider change font-size to 16px or above Soution 2: using javascript if(navigator.userAgent.indexOf('iPhone') > -1 ) { document .querySe 阅读全文
posted @ 2023-07-17 17:16 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:Merge variadic number of types into a new type. If the keys overlap, its values should be merged into an union. For example: type Foo = { a: 1; b: 2 } 阅读全文
posted @ 2023-07-17 02:37 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Implement type CheckRepeatedChars<T> which will return whether type T contains duplicated member For example: type CheckRepeatedTuple<[1, 2, 3]> // fa 阅读全文
posted @ 2023-07-17 01:55 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Remove the key starting with _ from given type T. /* _____________ Your Code Here _____________ */ type PublicType<T extends object> = { [Key in keyof 阅读全文
posted @ 2023-07-17 01:43 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Empty commits might seem unusual, but they offer significant advantages in managing version control. By documenting milestones, triggering automation 阅读全文
posted @ 2023-07-16 01:32 Zhentiw 阅读(31) 评论(0) 推荐(0) 编辑
摘要:You're given two identical crystal balls and a 100-story building. The balls are incredibly tough, but there exists some floor in the building, above 阅读全文
posted @ 2023-07-08 20:23 Zhentiw 阅读(60) 评论(0) 推荐(0) 编辑
摘要:type OverloadedReturnType<T> = T extends { (...args: any[]) : infer R; (...args: any[]) : infer R; (...args: any[]) : infer R ; (...args: any[]) : inf 阅读全文
posted @ 2023-07-06 14:17 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_container_queries .container { container: article / inline-size; } h2 { font-size: 7cqw; } @conta 阅读全文
posted @ 2023-07-06 03:14 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要:The margin-trim property allows the container to trim the margins of its children where they adjoin the container's edges. https://developer.mozilla.o 阅读全文
posted @ 2023-07-06 03:05 Zhentiw 阅读(38) 评论(0) 推荐(0) 编辑
摘要:html: <div class="post"> <h2>Post</h2> <a href="#"> a link</a> </div> <div class="post"> <h2>Post</h2> </div> <div class="post"> <a href="#"> a link</ 阅读全文
posted @ 2023-07-06 03:01 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示