01 2023 档案
摘要:### Create a docker file 1. Cd to the project: `cd widget-factory-inc/` 2. create a dockerfile: `vim dockerfile` ```bash FROM httpd:2.4 RUN apt update
阅读全文
摘要:Union type: function runGenerator(generator: { run: () => string } | (() => string)) { if (typeof generator 'function') { return generator(); } return
阅读全文
摘要:TypeScript 5.0 now allows JSDoc to declare overloads with a new @overload tag. Each JSDoc comment with an @overload tag is treated as a distinct overl
阅读全文
摘要:https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#exhaustive-switch-case-completions In the example code: type HasNames = { na
阅读全文
摘要:Configuration and Installation Obtain the Azure login credentials: az login Copy the code provided by the command. Open a browser and navigate to http
阅读全文
摘要:The following code import { expect, it } from 'vitest'; import { Equal, Expect } from '../helpers/type-utils'; export interface Cache<T> { get: (key:
阅读全文
摘要:Storing Container Data in AWS S3 Introduction Using Docker volumes is the preferred method of storing container data locally. Volume support is built
阅读全文
摘要:import { expect, it } from "vitest"; import { Equal, Expect } from "../helpers/type-utils"; function youSayGoodbyeISayHello(greeting: unknown) { retur
阅读全文
摘要:Introduction Docker volumes is the preferred method of storing container data locally. Volume support is built directly into Docker, making it an easy
阅读全文
摘要:Storing data within a container image is one option for automating a container with data, but it requires a copy of the data to be in each container y
阅读全文
摘要:Pull httpd image and run the container [cloud_user@ip-10-0-1-78 ~]$ docker pull httpd:2.4 [cloud_user@ip-10-0-1-78 ~]$ docker run --name webtemplate -
阅读全文
摘要:Sometimes we when switch branch, might bring some modified files into the new branch to cleanup those files git clean -df https://git-scm.com/docs/git
阅读全文
摘要:Pull httpd:latest image Normally you want to attach the version httpd:2.4, because everytime you run the image, we with the same version is running. b
阅读全文
摘要:let context = [] function cleanup(observer) { for (const dep of observer.dependencies) { dep.delete(observer) } } function subscribe(observer, subscri
阅读全文
摘要:Previously, we have problem for such code: type RGB = readonly [red: number, green: number, blue: number]; type Color = { value: RGB | string }; const
阅读全文
摘要:import { test } from '@playwright/test'; test.beforeEach(async ({ page }) => { await page.goto('http://localhost:3000'); }); test('selectors', async (
阅读全文
摘要:In this lesson, we are using HTML, accessibility concepts, and ARIA attributes to improve the time scrubber feature of an audio player. The goal is to
阅读全文
摘要:Consider this createClassNamesFactory function that's similar to one I built for getting Tailwind class names that could then be passed into a React c
阅读全文
摘要:This exercise begins with a makeStatus function that takes in an array of TStatuses that extends an array of strings. The statuses are then returned,
阅读全文
摘要:There are two solutions to this challenge, both with different ways of representing the generic. Solution 1: The first option is using TConfig which e
阅读全文
摘要:See this code: const array = [ { name: 'John', }, { name: 'Steve', }, ]; const obj = array.reduce((accum, item) => { accum[item.name] = item; // Eleme
阅读全文
摘要:Here we have a Component class that can be passed in TProps. Inside of the constructor it assigns props to this, and provides a getProps method that c
阅读全文
摘要:Consider this implementation of returnBothOfWhatIPassIn: const returnBothOfWhatIPassIn = (params: { a: unknown; b: unknown }) => { return { first: par
阅读全文
摘要:Let's we have a form to submit new password. Before we send request to server, we want to force developer to valid the password before sending the req
阅读全文
摘要:// print type PrintStart = { type: "print"; subtype: "start"; attributes: { controlsId: string; tabId: number; }; } type PrintAbort = { type: "print";
阅读全文
摘要:Let's imagine you're building a type helper to extract out the value from several different 'parsers'. Here are a few different examples of what a par
阅读全文
摘要:Binding to Media Events import './assets/css/style.css'; import autumnMp4 from './assets/media/autumn.mp4'; const app = document.getElementById('app')
阅读全文
摘要:A company has hired N interns to each join one of N different teams. Each intern has ranked their preferences for which teams they wish to join, and e
阅读全文