Instead of using devtools to change text content of a specific element, just press alt
and click on that element, its text content will be repeated 5 times. Press shift alt
and click it again to reset its text content to original value.
#!/usr/bin/pwsh | |
# meminfo -sort <name|value> -list | |
param( | |
[Parameter(Mandatory = $false)] [switch] $list = $false, | |
[parameter(Mandatory = $false)] [switch] $human = $false, | |
[Parameter(Mandatory = $false)] [ValidateSet('name', 'value')] [string] $sort = 'value' | |
) | |
# read /proc/meminfo |
(defcfg | |
input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") | |
;; To understand the importance of the following line, see the section on | |
;; Compose-key sequences at the near-bottom of this file. | |
output (uinput-sink "KMonad: HP EliteBook 845 G8" "/usr/bin/sleep 1 && /usr/bin/setxkbmap -option compose:ralt") | |
;; Set the compose key to `RightAlt' | |
cmp-seq ralt | |
;; 5ms delay between each compose-key sequence press | |
;; todo: not available now | |
;; cmp-seq-delay 5 |
nmap <Space> <Nop> | |
let mapleader = " " | |
" Options | |
set ignorecase | |
set smartcase | |
set scrolloff=5 " 5 lines above/below cursor when scrolling | |
set clipboard+=ideaput | |
set clipboard+=unnamedplus | |
set ideajoin |
npm set registry https://registry.npm.taobao.org && \ | |
npm set disturl https://npm.taobao.org/dist && \ | |
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \ | |
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ && \ | |
npm set puppeteer_download_host https://storage.googleapis.com.cnpmjs.org && \ | |
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver && \ | |
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver && \ | |
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs && \ | |
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium && \ | |
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector && \ |
npm set registry https://registry.npm.taobao.org && \ | |
npm set disturl https://npm.taobao.org/dist && \ | |
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \ | |
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ && \ | |
npm set puppeteer_download_host https://storage.googleapis.com.cnpmjs.org && \ | |
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver && \ | |
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver && \ | |
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs && \ | |
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium && \ | |
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector && \ |
1月24日,F# 4.6 预览版正式公布,与以往一样,新版本的设计与开发过程是整个 F# 开源社区共同努力的结果,这次更新的具体讨论内容可以通过下面两个链接来查看:
这次更新的主要内容有:
- 匿名记录类型(Anonymous Records)
在 F# 中,Record Type 是无法表达 `null` 语义的,例如,一个 Record 变量不能够使用 `null` 字面量赋值,接收 nullable(这里并不是指 BCL 中的 `Nullable<T>` 类型,而是指 C# 8.0 之前的引用类型)作为参数的函数不能使用 Record 作为参数: | |
```fsharp | |
type Foo = {Id: string} | |
let foo: Foo = null // 编译错误 | |
let foo = {Id: "2333"} // 编译通过 | |
let fooOp = Option.ofObj foo // 编译错误 | |
``` |
在 Angular 应用中,我们有两种方式来实现表单绑定——“模板驱动表单”与“响应式表单”。这两种方式通常能够很好的处理大部分的情况,但是对于一些特殊的表单控件,例如input[type=datetime]
、input[type=file]
,我们需要重写默认的表单绑定方式,让我们绑定的变量不再仅仅只是一个字符串,而是一个 Date
或者 File
对象。为了达成这一目的,我们需要自定义表单控件的 ControlValueAccessor
。
ControlValueAccessor
接口是 Angular Forms API 与 DOM 之间的桥梁,通过提供不同的 ControlValueAccessor
,我们就可以使用统一的 Angular Forms API 来操作不同的 HTML 表单元素。
在我们使用 ngModel
或者 formControl
的时候,这两个 Directive 会向 Angular 的依赖注入容器申请实现了 ControlValueAccessor
接口的对象,这是一种典型的面向接口编程的设计。例如,如果我们需要为 input[type=file]
提供一个用来绑定 File
对象的 ControlValueAccessor
,只需要在依赖注入容器中提供一个 FileControlValueAccessor
的实现就可以了。不过,我们并不想覆盖其他类型 input
元素的 ControlValueAccessor
,因为那样肯定会对已有代码造成大范围的破坏。所以在这里,我们需要使用 Angular 的分层注入能力——在 ElementInjector 中提供 FileControlValueAccessor
。关于 ElementInjector 更多的内容,请看这里 a-curios-case-of-the-host-decorator-and-element-injectors-in-angular。
下面演