Latest Posts

    • resource hint
    • preload
    • prefetch
    • preconnect

    Preload & Prefetch & Preconnect

    Preload & Prefetch & Preconnect

    • Terminal

    Terminal Settings

    Download link: https://iterm2.com/ [https://iterm2.com/] Download font: https://github.com/tonsky/FiraCode [https://github.com/tonsky/FiraCode] Set style: Preferences → Appearance → General → Theme → Minimal Set status bar: Preferences → Profiles → Sessions → Status bar enable → Configure Status bar Set status bar position: Prefe

    • mobx

    mobx

    Click to run embedded content: https://codesandbox.io/embed/new-dew-ec8bg In mobx-react, any component that uses data from a mobx store must be decorated with @observer. This applies even if the data is passed in via props.

    • Mobile Development
    • Modals

    Disable Background Scrolling for Mobile Modals

    import React, { Component } from 'react'; import PropTypes from 'prop-types'; import withStyle from 'react-jss'; import c from '../../utils/classnames'; const style = (theme) => ({ wrapper: { position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 4, backgrou

    • Mobile Development
    • iOS

    Touch event on iOS

    If a webview is embedded inside an iOS app, and the webview only occupies part of the screen, then when a finger swipes inside the webview too quickly and moves beyond the webview window, if the finger leaves the screen at that moment, the touchend event inside the webview will not be triggered. The code will stay stuck on the touchmove event forever. The solution is to set a timeout on touchmove to automatically trigger a touchend event. But there is an even more surprising thing: when the finger remains inside the webview window, you can manually create an event using new TouchEvent('touchend'). But when the finger moves outside the webview window, n

    • Mobile Development
    • Debugging

    Mobile Development and Debugging

    ANDROID CHROME REMOTE DEBUGGING https://developers.google.com/web/tools/chrome-devtools/remote-debugging/https://developers.google.com/web/tools/chrome-devtools/remote-debugging/ [https://developers.google.com/web/tools/chrome-devtools/remote-debugging/] Requirement * Chrome 32 or higher in your d

    • Mobile Development
    • iOS

    iOS iframe height and width settings

    iOS iframe height and width settings

    • JavaScript

    Creating Functions Using new Function

    > Syntax new Function ([arg1[, arg2[, …argN]],] functionBody) Functions created by using the constructor to generate a new instance have the following characteristics compared with function declarations: * Functions can be generated dynamically * All functions are anonymous, and Function.name is always anonymous * The function body cannot reference local variables and can only reference global variables var x = 10; function createFunction1() { var x = 20; return new Function("return x;"); // this |x| refers global |x| } functi

  1. Development Tips

    1. The context following console.log.apply must be console, not window or others; otherwise, the following error is thrown: Uncaught TypeError: Illegal invocation at log (:2:30) at :2:1 at Object.InjectedScript._evaluateOn (:905:140) at Object.InjectedScript._evaluateAndWrap (

    • ESXi
    • passthrough

    USB device passthrough to a virtual machine did not work on ESXi 6.5

    1. SSH into ESXi 2. Run esxcli system module set -m=vmkusb -e=FALSE. This command disables the new vmkusb module in ESXi 6.5 and switches to the traditional USB driver. 3. After running the command, restart ESXi, and the USB device will work normally. Reference: 1. https://communities.vmware.com/thread/547408