07 2020 档案
摘要:const displayMachine = createMachine({ initial: "hidden", states: { hidden: { on: { TURN_ON: "visible.hist", }, }, visible: { initial: "light", states
阅读全文
摘要:When dragging, we want to have two modes, one in 'normal' mode, another one is 'locked', we enter the locked mode by holde on 'shift' key. To achieve
阅读全文
摘要:When working with databases, it seems inevitable that you will find yourself needing to export data from a table to send along to another team, compan
阅读全文
摘要:import { createMachine, assign, interpret } from "xstate"; const elBox = document.querySelector("#box"); const elBody = document.body; const assignPoi
阅读全文
摘要:It uses " " as key, by default, this is the inital state, it often uses with 'cond' import { createMachine, assign, interpret } from "xstate"; const e
阅读全文
摘要:In this lesson, we'll learn how to use CSS Clip Path to add a notch clip-path: polygon( 0% 10%, 10% 0%, /*topleft*/ 92% 0, 100% 8%, /*top right*/ 100%
阅读全文
摘要:In this lesson, we cover how to replace the default text-decoration for links with an animated underline. We use multiple background images with a fix
阅读全文
摘要:routes/index.js: used for defined all the endpoints: import express from "express"; import * as notes from "./notes.js"; const router = express.Router
阅读全文
摘要:In this lesson we'll build a basic web server in 2 minutes using Express 5 and node 14's native ES module support. We'll start by creating a new proje
阅读全文
摘要:Renaming every file in a directory with zsh is a common scenario when you're working with a series of related files. Using zsh's "for" loop, you can a
阅读全文
摘要:
阅读全文
摘要:JavaScript numbers and CSS hexadecimal numbers don't play very well together. You can solve this with a conversion function that takes the number, con
阅读全文
摘要:When express App run syncronous code: app.get("/test", (req, res) => { throw new Error("Oh no! The world has ended!"); }); Those code works fine. But
阅读全文
摘要:If we have just one feature, the error is big, preformance is not good; but if we have too many features selected then it might be overfitting. So we
阅读全文
摘要:Just like the title h1 { font-size: 5vw; } Make font responsive to view width
阅读全文
摘要:Garuded Transitions, it prevents the state goes from current sate to its target state is condition is falsy. const machine = createMachine( { initial:
阅读全文
摘要:import { createMachine, assign, interpret } from "xstate"; const elBox = document.querySelector("#box"); const elBody = document.body; const assignPoi
阅读全文
摘要:Right now, we're getting the ID route parameter off the of the parent route. This is because we want the info and items components to use the ID of th
阅读全文
摘要:Using the https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API(Web Speech API) it is possible to use speech synthesis in the browser withou
阅读全文
摘要:We have a message app: function App() { const messageDisplayRef = React.useRef() .... const scrollToTop = () => messageDisplayRef.current.scrollToTop(
阅读全文
摘要:Let's we want to keep tracking how many times on element was click inside Machine model. We can use 'context' & 'assign' function. import { assign, cr
阅读全文
摘要:Let's say we have a State Machine Model: import { createMachine, interpret } from "xstate"; const elBox = document.querySelector("#box"); const setPoi
阅读全文
摘要:The k-means algorithm captures the insight that each point in a cluster should be near to the center of that cluster. It works like this: first we cho
阅读全文
摘要:#!/usr/bin/python import random import numpy import matplotlib.pyplot as plt import pickle from outlier_cleaner import outlierCleaner from sklearn.lin
阅读全文
摘要:import { createMachine, interpret } from "xstate"; const elBox = document.querySelector("#box"); const machine = { initial: "inactive", states: { inac
阅读全文
摘要:State + Event + Interpreter: const machine = { initial: "idle", states: { idle: { on: { FETCH: "pending", }, }, pending: { on: { RESOLVE: "resolved",
阅读全文
摘要:Let's say we have a command line application: const { Task } = require("../../libs/types"); const { save, all } = require("../../libs/db"); const { la
阅读全文
摘要:An ancient problem of centering items with CSS is finally (!) solved! In this quick lesson we're going to learn how to use place-items CSS property in
阅读全文
摘要:Decision trees can handle none linear speratable dataset, in the picture, there is none separable dataset When we use dscision tree, we ask multi line
阅读全文
摘要:Take the native HTML checkboxes and jazz them up while still ensuring they are keyboard accessible. We use pseudo-elements and pseudo-classes to repli
阅读全文
摘要:In this lesson, we dive into using CSS border-radius. We will look at how you can use it to create not only basic shapes but complex ones too. We will
阅读全文
摘要:Building larger serverless applications can be tricky - creating many lambda functions as well as other resources such as DynamoDB tables, S3 buckets,
阅读全文
摘要:Path: Compose Functors -> Monad Transformers -> Free Monad Free monads, it provides a way to modelling functions as Data type. So composing / chaining
阅读全文