~❯ brew update && brew upgrade && brew cask upgrade && brew cleanup && brew doctorto get brew ready~❯ brew cask install docker-edge~❯ echo "export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker" >> $ZDOTDIR/.zshenv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type HasTail<T extends any[]> = | |
| T extends [] | [any] | |
| ? false | |
| : true | |
| type Type1 = HasTail<[age: number, single: boolean]> // true | |
| type Type2 = HasTail<[single: boolean]>> // false | |
| // https://medium.com/free-code-camp/typescript-curry-ramda-types-f747e99744ab | |
| // https://github.com/millsp/medium/blob/master/types-curry-ramda/src/index.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Tail<T extends any[]> = ((...t: T) => any) extends ( | |
| _: any, | |
| ...tail: infer TT | |
| ) => any | |
| ? TT | |
| : [] | |
| type Type1 = Tail<[age: number, single: boolean]> // [single: boolean] | |
| type Type2 = Tail<Type1> // [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Head<T extends any[]> = | |
| T extends [any, ...any[]] | |
| ? T[0] | |
| : never | |
| type Type1 = Head<[name: string, age: number, single: boolean]> // string | |
| // https://medium.com/free-code-camp/typescript-curry-ramda-types-f747e99744ab | |
| // https://github.com/millsp/medium/blob/master/types-curry-ramda/src/index.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Params<F extends (...args: any[]) => any> = F extends ( | |
| ...args: infer A | |
| ) => any | |
| ? A | |
| : never | |
| const fn00 = (name: string, age: number, single: boolean) => true | |
| type Type1 = Params<typeof fn00> // [name: string, age: number, single: boolean] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Then | |
| const append = (values: string[], value: string) => { | |
| (values ?? (values = [])).push(value) | |
| return values | |
| } | |
| // Now | |
| const append = (values: string[], value: string) => { | |
| (values ??= []).push(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FooModule } from "@foo/modules" | |
| import { config } from "@foo/config" | |
| @NgModule( { | |
| imports: [ | |
| BrowserModule, | |
| FooModule.forRoot(config) | |
| ] | |
| bootstrap: [ AppComponent ], | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Todo { | |
| id: number, | |
| text: string, | |
| done: boolean | |
| } | |
| const todo: Todo = { | |
| id: 1, | |
| text: 'learn TS', | |
| done: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| POST events/user/:id/_update | |
| { | |
| "script": { | |
| "lang": "painless", | |
| "source": "if (ctx._source.on_screen_view == null) { ctx._source.on_screen_view = [] }\nfor (int i = 0; i < params.events.length; i++) {\nctx._source.on_screen_view.add(params.events[i])\n}\n", | |
| "params": { | |
| "events": [ | |
| "2019-07-10T21:57:46.173Z", | |
| "2019-07-10T20:49:34.429Z", | |
| "2019-07-10T20:50:08.135Z" |