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
| const noop = () => null; | |
| // const writeFileSync = mkdirSync = cpSync = noop; | |
| const { | |
| writeFileSync, mkdirSync, cpSync, | |
| existsSync, readFileSync} = require("fs"); | |
| const { workspaceRoot } = require("nx/src/devkit-exports"); | |
| const path = require("path"); | |
| const CONFIG = { | |
| appName: "myapp", // must exist under apps/ |
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 { Chat } from '@hashbrownai/core'; | |
| import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; | |
| type UIObject = { | |
| ui: Array<Record<string, unknown>>; | |
| }; | |
| export async function* processChunksAsync( | |
| stream: ChatCompletionStream<null>, | |
| ): AsyncGenerator<Chat.Api.CompletionChunk, void, unknown> { |
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
| [alias] | |
| pushfl = push --force-with-lease | |
| l = log | |
| lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches | |
| ch = checkout | |
| cm = commit -m | |
| acm = !git add . && git commit -m | |
| rsft = reset --soft HEAD~1 | |
| rshd = reset --hard | |
| rshd1 = reset --hard HEAD~1 |
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 { execSync } from 'child_process'; | |
| import { output } from '@nx/devkit'; | |
| import yargs from 'yargs'; | |
| import { hideBin } from 'yargs/helpers'; | |
| import { | |
| ensureHeadAndBaseAreSet, | |
| findClosestProjectByFilePath, | |
| getFilesUsingBaseAndHead, |
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
| { | |
| "parser": "@typescript-eslint/parser", | |
| "parserOptions": { | |
| "project": ["tsconfig.*?.json"], | |
| "warnOnUnsupportedTypeScriptVersion": false | |
| }, | |
| "plugins": ["rxjs", "rxjs-angular"], | |
| "overrides": [ | |
| { | |
| "files": ["*.ts", "*.tsx"], |
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
| const control = new FormControl('Hello, world!'); | |
| control.reset(); | |
| console.log(control.value); // null |
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 { runValueAccessorTests } from 'ngx-cva-test-suite'; | |
| import { CounterControlComponent } from './counter.component'; | |
| runValueAccessorTests({ | |
| /** Component, that is being tested */ | |
| component: CounterControlComponent, | |
| /** | |
| * All the metadata required for this test to run. | |
| * Under the hood calls TestBed.configureTestingModule with provided config. | |
| */ |
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
| // ... code of CounterComponent | |
| writeValue(value: number) { | |
| // it's convenient to reuse existing "setValue" method, right? | |
| // however, this will lead to the incorrect behavior | |
| this.setValue(value, false); | |
| this._cdr.markForCheck(); | |
| } | |
| protected setValue(value: number, emitEvent: boolean) { | |
| this.value = 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
| interface ControlValueAccessor { | |
| writeValue(obj: any): void | |
| registerOnChange(fn: any): void | |
| registerOnTouched(fn: any): void | |
| setDisabledState(isDisabled: boolean)?: void | |
| } |
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
| // ... code of CounterComponent | |
| writeValue(value: number) { | |
| // it's convenient to reuse existing "setValue" method, right? | |
| // however, this will lead to the incorrect behavior | |
| this.setValue(value); | |
| this._cdr.markForCheck(); | |
| } | |
| protected setValue(value: number) { | |
| const parsed = parseInt(value as any); |
NewerOlder