03 2020 档案

摘要:Let's say we want to dynamiclly change some style in :before or :after element. We cannot use NgStyle, it doesn's support this use case, what we can d 阅读全文
posted @ 2020-03-31 02:30 Zhentiw 阅读(169) 评论(0) 推荐(0) 编辑
摘要:No matter how hard you try, eventually your app code just isn’t going to behave the way you expect it to and you’ll need to handle those exceptions. I 阅读全文
posted @ 2020-03-31 01:45 Zhentiw 阅读(178) 评论(0) 推荐(0) 编辑
摘要:const app = document.getElementById('app'); app.innerHTML = ` <h1>JavaScript DOM</h1> <ul id="list"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> 阅读全文
posted @ 2020-03-30 02:07 Zhentiw 阅读(149) 评论(0) 推荐(0) 编辑
摘要:const app = document.getElementById('app'); app.innerHTML = ` <h1>JavaScript DOM</h1> <div class="item"></div> `; const item = document.querySelector( 阅读全文
posted @ 2020-03-30 02:06 Zhentiw 阅读(100) 评论(0) 推荐(0) 编辑
摘要:Understanding the order in which React hooks are called can be really helpful in using React hooks effectively. This chart can be really helpful in un 阅读全文
posted @ 2020-03-29 22:18 Zhentiw 阅读(278) 评论(0) 推荐(0) 编辑
摘要:React is really good at creating and updating DOM elements, but sometimes you need to work with them yourself. A common use case for this is when you’ 阅读全文
posted @ 2020-03-29 21:57 Zhentiw 阅读(115) 评论(0) 推荐(0) 编辑
摘要:Before: <body> <div id="root"></div> <script src="https://unpkg.com/react@16.12.0/umd/react.development.js"></script> <script src="https://unpkg.com/r 阅读全文
posted @ 2020-03-29 21:46 Zhentiw 阅读(230) 评论(0) 推荐(0) 编辑
摘要:In angular.json 阅读全文
posted @ 2020-03-29 00:19 Zhentiw 阅读(134) 评论(0) 推荐(0) 编辑
摘要:"Legacy" image formats like jpg and png are often 2-3x larger than "next-gen" image formats like webp. In this video, we'll see how to convert our ima 阅读全文
posted @ 2020-03-26 19:17 Zhentiw 阅读(129) 评论(0) 推荐(0) 编辑
摘要:Sometimes you'd like to measure how two implementations compare in regards to run time. In this lesson you will learn how to quickly do this using Con 阅读全文
posted @ 2020-03-26 18:36 Zhentiw 阅读(165) 评论(0) 推荐(0) 编辑
摘要:In this lesson we will see how to measure the used JS heap size in chrome. This can be used for various needs from performance debugging to production 阅读全文
posted @ 2020-03-26 18:33 Zhentiw 阅读(269) 评论(0) 推荐(0) 编辑
摘要:In this lesson we will learn about how to define real private properties in javascript classes. Before: class Pasta { constructor(name) { this._name = 阅读全文
posted @ 2020-03-26 18:29 Zhentiw 阅读(128) 评论(0) 推荐(0) 编辑
摘要:You can open files into Vim directly from the terminal. This works for both single files and multiple files. In addition to reading these files into b 阅读全文
posted @ 2020-03-26 18:22 Zhentiw 阅读(97) 评论(0) 推荐(0) 编辑
摘要:Component to be tested: <ng-template #defaultPlaceholder> Loading... </ng-template> <div class="loading-container" *ngIf="loading$ | async"> <ng-conta 阅读全文
posted @ 2020-03-25 19:29 Zhentiw 阅读(3379) 评论(0) 推荐(0) 编辑
摘要:Component: <div class="loading-placeholder" [ngClass]="extraClass"> &nbsp; <ng-container *ngIf="loadingService.config.showContent"> <ng-content></ng-c 阅读全文
posted @ 2020-03-24 22:15 Zhentiw 阅读(262) 评论(0) 推荐(0) 编辑
摘要:You'll often find yourself going through a tutorial where you need to copy some code from a webpage and create a file and paste the contents onto your 阅读全文
posted @ 2020-03-23 16:26 Zhentiw 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Generators can yield promises which can work with the "for await of" loop syntax. This lesson shows how all the pieces fit together and explains why t 阅读全文
posted @ 2020-03-22 02:59 Zhentiw 阅读(161) 评论(0) 推荐(0) 编辑
摘要:The "for await of" loop syntax enables you to loop through an Array of Promises and await each of the responses asynchronously. This lesson walks you 阅读全文
posted @ 2020-03-22 02:55 Zhentiw 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Read from blog 阅读全文
posted @ 2020-03-22 02:47 Zhentiw 阅读(171) 评论(0) 推荐(0) 编辑
摘要:NaN == NaN // false NaN NaN // false Object.is(NaN, NaN) // true Number.isNaN(NaN) // true typeof NaN // number Because NaN is number type, so there i 阅读全文
posted @ 2020-03-22 02:24 Zhentiw 阅读(160) 评论(0) 推荐(0) 编辑
摘要:-0 0 // true 阅读全文
posted @ 2020-03-22 02:19 Zhentiw 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-03-22 02:16 Zhentiw 阅读(139) 评论(0) 推荐(0) 编辑
摘要:const app = document.getElementById('app'); app.innerHTML = ` <h1>JavaScript DOM</h1> <ul> <li>1</li> </ul> `; const ul = app.querySelector('ul'); ul. 阅读全文
posted @ 2020-03-21 20:43 Zhentiw 阅读(154) 评论(0) 推荐(0) 编辑
摘要:const app = document.getElementById('app'); app.innerHTML = ` <h1>JavaScript DOM</h1> `; const div = document.createElement('div'); const span = docum 阅读全文
posted @ 2020-03-21 20:37 Zhentiw 阅读(170) 评论(0) 推荐(0) 编辑
摘要:DocumentFragment can create virtual dom tree. It can helps to avoid layout reflow.. problems Code has profermance problem: const data = ['Earth', 'Fir 阅读全文
posted @ 2020-03-20 22:15 Zhentiw 阅读(103) 评论(0) 推荐(0) 编辑
摘要:We will create animated Content Placeholder as React component just like Facebook has when you load the page. Key points: 1. For each elements on the 阅读全文
posted @ 2020-03-17 19:03 Zhentiw 阅读(143) 评论(0) 推荐(0) 编辑
摘要:import './assets/css/style.css'; const app = document.getElementById('app'); app.innerHTML = '<h1>JavaScript DOM</h1>'; // <html> console.log(document 阅读全文
posted @ 2020-03-17 03:34 Zhentiw 阅读(124) 评论(0) 推荐(0) 编辑
摘要:举个例子: “把这份报告复印一下”。 5W2H Who: 小张 What:复印报告 How: 用高品质复印 When:下班前 Where: 总经理办公室 How many:2份 Why:给客户做参考 整理后: “请你将这份报告复印2份,在下班前送到总经理办公室交给总经理。请留意复印的质量,总经理要带 阅读全文
posted @ 2020-03-16 03:51 Zhentiw 阅读(1221) 评论(0) 推荐(0) 编辑
摘要:// Definition const Endo = run => ({ run, concat: other => Endo(x => other.run(run(x))) }); Endo.empty = () => Endo(x => x); // Ex1: // const classToC 阅读全文
posted @ 2020-03-15 21:12 Zhentiw 阅读(210) 评论(0) 推荐(0) 编辑
摘要:Normally when we use 'map', we do the transform base on the output. 'contramap' can do the transform base on the input, which means, before the orgina 阅读全文
posted @ 2020-03-15 21:11 Zhentiw 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Endo: It takes a type as string and output is the same type. It's concat methods works like composion. All the transform functions on the same input. 阅读全文
posted @ 2020-03-15 18:10 Zhentiw 阅读(138) 评论(0) 推荐(0) 编辑
摘要:There are two types of Loading events: DOMContentLoaded Loaded DOMEContentLoaded: It happens after index.html has been parsed. <!DOCTYPE html> <html> 阅读全文
posted @ 2020-03-15 02:57 Zhentiw 阅读(149) 评论(0) 推荐(0) 编辑
摘要:const Reader = run => ({ run, map: f => Reader(x => f(run(x))), chain: f => Reader(x => f(run(x)).run(x)), concat(o) { return Reader(x => run(x).conca 阅读全文
posted @ 2020-03-14 05:07 Zhentiw 阅读(144) 评论(0) 推荐(0) 编辑
摘要:Let's say we have App.component.ts, it use provider inside component level: @Component({ selector: 'app-root', templateUrl: './app.component.html', st 阅读全文
posted @ 2020-03-14 04:37 Zhentiw 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Rules Each page should have at least one <h1> Pages should be structured in a hierarchical manner <h1>: being the most important (usually page titles 阅读全文
posted @ 2020-03-13 16:28 Zhentiw 阅读(109) 评论(0) 推荐(0) 编辑
摘要:Reader Monad Continue with previous post, here we have some helper functions: const toUpper = s => s.toUpperCase(); const exclaim = s => `${s}!`; And 阅读全文
posted @ 2020-03-13 04:10 Zhentiw 阅读(219) 评论(0) 推荐(0) 编辑
摘要:Let's say we have two fucntions: const toUpper = s => s.toUpperCase(); const exclaim = s => `${s}!`; We want to combine those. But function itself doe 阅读全文
posted @ 2020-03-13 03:39 Zhentiw 阅读(141) 评论(0) 推荐(0) 编辑
摘要:useState is typically simpler at first than useReducer (you can even implement useState using useReducer), but there's one scenario where useReducer i 阅读全文
posted @ 2020-03-11 17:56 Zhentiw 阅读(262) 评论(0) 推荐(0) 编辑
摘要:Learn how to use custom events to expose internal events from withing a web component. class MyWelcome extends HTMLElement { constructor() { super(); 阅读全文
posted @ 2020-03-11 16:31 Zhentiw 阅读(162) 评论(0) 推荐(0) 编辑
摘要:We want to write a Monoid, which able to take function called 'run', therefore we able to run a serial of functions together to get a combined result. 阅读全文
posted @ 2020-03-10 18:09 Zhentiw 阅读(179) 评论(0) 推荐(0) 编辑
摘要:const [state, dispatch] = useReducer(reducer, initialArg, init); The third arguement 'init' is a lazy initialization which is a function. It is useful 阅读全文
posted @ 2020-03-10 16:35 Zhentiw 阅读(214) 评论(0) 推荐(0) 编辑
摘要:MECE:Mutually exclusive collectively exhaustive, 相互独立,完全穷尽,“不重叠,不遗漏” -- 《金字塔原理》Barbara Minto 如何避免在做汇报时,逻辑层次混乱?-- MECE 如何理解,不重叠,不遗漏? 例如:“把目标用户都列出来:男人,小 阅读全文
posted @ 2020-03-09 03:19 Zhentiw 阅读(822) 评论(0) 推荐(0) 编辑
摘要:As a user, it can be very disorienting when the "wrong" UI is briefly shown to the user: a login link is shown to an authenticated user, or a 404 erro 阅读全文
posted @ 2020-03-08 04:02 Zhentiw 阅读(98) 评论(0) 推荐(0) 编辑
摘要:For example, we want to show loading spinner inside our appliction component trees. Because we might trigger loading spinner anywhere inside our appli 阅读全文
posted @ 2020-03-07 00:20 Zhentiw 阅读(414) 评论(0) 推荐(0) 编辑
摘要:When new to Reactive programming with Angular. It is easy to fall into a performance issue, which is sending multi same http request to the backend. I 阅读全文
posted @ 2020-03-05 21:31 Zhentiw 阅读(349) 评论(0) 推荐(0) 编辑
摘要:For example we have following code: $(el).hide() // el.style.display = 'none' $(el).forEach(() => {}) foo.hide() We want $(el).hide() replace with: el 阅读全文
posted @ 2020-03-05 17:58 Zhentiw 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Are you using z? Greatly speed up your file system traversal and say goodbye to finder. Install: brew install z 2. Go the github: https://github.com/r 阅读全文
posted @ 2020-03-05 03:12 Zhentiw 阅读(197) 评论(0) 推荐(0) 编辑
摘要:For example we want to just conver a VariableDeclaration to Foo.bar.otherBaz("one", 2); We can use Babel template to do that: export default function( 阅读全文
posted @ 2020-03-04 21:18 Zhentiw 阅读(357) 评论(0) 推荐(0) 编辑
摘要:Layout reflow Layout reflow can be a performance bottleneck. Let's see how to identify it in the browser and what causes the reflow. In normal process 阅读全文
posted @ 2020-03-04 19:56 Zhentiw 阅读(332) 评论(0) 推荐(0) 编辑
摘要:It’s pretty likely that we’ll need to login as a particular user for many tests, let’s take our cy.request command and turn it into a custom command t 阅读全文
posted @ 2020-03-03 19:12 Zhentiw 阅读(289) 评论(0) 推荐(0) 编辑
摘要:Component: import { Component, OnInit } from "@angular/core"; import { TwainService } from "../twain.service"; import { Observable, of } from "rxjs"; 阅读全文
posted @ 2020-03-03 17:55 Zhentiw 阅读(477) 评论(0) 推荐(0) 编辑
摘要:Create a .github directory at the root of your project Add a file called pull_request_template.md . Here's an example: This PR... ## Changes - ## Scre 阅读全文
posted @ 2020-03-02 14:20 Zhentiw 阅读(655) 评论(0) 推荐(0) 编辑
摘要:Create a .github directory at the root of your project Create an ISSUE_TEMPLATE directory inside the .github directory Add a file called bug_report.md 阅读全文
posted @ 2020-03-02 14:18 Zhentiw 阅读(352) 评论(0) 推荐(0) 编辑
摘要:Install: npm i debug supports-color --save Docs Code: // stdout.js var debug = require('debug'); var error = debug('app:error'); // by default stderr 阅读全文
posted @ 2020-03-01 21:09 Zhentiw 阅读(260) 评论(0) 推荐(0) 编辑
摘要:Sometimes you still want to support the API and quick developer experience of a single command, while still supporting multi commands in your CLI. Thi 阅读全文
posted @ 2020-03-01 20:43 Zhentiw 阅读(192) 评论(0) 推荐(0) 编辑
摘要:Heavy duty CLI's like gatsby and npm do more than one thing. The convention is to namespace them with a command name after the CLI name, like gatsby n 阅读全文
posted @ 2020-03-01 20:16 Zhentiw 阅读(295) 评论(0) 推荐(0) 编辑
摘要:The fastest way to create a robust, cross-platform compatible Node.js CLI (optionally typed with TypeScript) is by running npx oclif single mycli. Her 阅读全文
posted @ 2020-03-01 19:06 Zhentiw 阅读(310) 评论(0) 推荐(0) 编辑
摘要:Before you use any frameworks, you should know the fundamentals of what makes Node CLI's tick. Here we explain everything you need to know to write a 阅读全文
posted @ 2020-03-01 02:35 Zhentiw 阅读(136) 评论(0) 推荐(0) 编辑

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