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
| function equal<Type, Key extends keyof Type>(propertyName: Key, value: Type[Key]) { | |
| return (item: Type) => item[propertyName] === value; | |
| } | |
| const arr = [ | |
| { id: 1, name: "juho" }, | |
| { id: 2, name: "kim" }, | |
| { id: 3, name: "holy" }, | |
| { id: 4, name: "jesus" }, | |
| { id: 5, name: "fire" }, |
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
| #if Windows | |
| Console.WriteLine("Windows!"); | |
| #elif Linux | |
| Console.WriteLine("Linuxw!"); | |
| #elif OSX | |
| Console.WriteLine("osx!"); | |
| #endif |
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
| # do before run.sh | |
| docker volume create postgres-volume |
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
| docker run \ | |
| --name mosquitto-container \ | |
| --restart always \ | |
| --detach \ | |
| -p 9001:9001 \ | |
| -p 1883:1883 \ | |
| eclipse-mosquitto:1.6 |
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
| // https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir | |
| type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends < | |
| T | |
| >() => T extends Y ? 1 : 2 | |
| ? A | |
| : B; | |
| type WritableKeys<T> = { | |
| [P in keyof T]-?: IfEquals< |
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
| services: | |
| kafka-node-1: | |
| container_name: kafka-node-1 | |
| image: confluentinc/cp-kafka:7.4.0 | |
| environment: | |
| CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk' | |
| KAFKA_NODE_ID: 1 | |
| KAFKA_PROCESS_ROLES: 'broker,controller' | |
| KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
| KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT' |
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
| plugins=( | |
| git | |
| dotnet | |
| docker | |
| docker-compose | |
| z | |
| zsh-autosuggestions | |
| zsh-syntax-highlighting | |
| ) |
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
| let continuationAction (t: Task<int>) = | |
| if not t.IsFaulted then | |
| logger.Info( | |
| "succ {@fetched} {@remained}", | |
| [| messages.Length :> obj; queue.Count |] | |
| ) | |
| else | |
| logger.Error( | |
| "error {@error}", | |
| [| t.Exception.InnerExceptions.Count :> obj |] |
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
| open System.Text.Json | |
| open MessagePack | |
| open MessagePack.Resolvers | |
| open MessagePack.Formatters | |
| open MessagePack.FSharp | |
| type JsonElementFormatter() as self = | |
| let jsonElementFormatter = (self :> IMessagePackFormatter<JsonElement>) |
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 type { ComponentOptionsMixin, DefineComponent, PropType } from "vue"; | |
| import type { | |
| Component, | |
| ComponentAttributes, // Record<string, unknown> | |
| ComponentEventMap // Record<string, CustomEvent> | |
| } from "./component"; | |
| type Attrs = { | |
| [P in keyof ComponentAttributes]: { | |
| type: PropType<NonNullable<ComponentAttributes[P]>>; |