High Order Function

var Type = {} for(var i =0, type; type =['String','Array','Number'][i++];){ (function(type){ Type['is'+type] = function(obj){ return Object.prototype.toString.call(obj) === '[object ' + type + ']'; } })(type) }; Type.isArray([]); Type.isString('abc'); var getSingle = function(fn){ var ret; return function(){ return ret || (ret = fn.apply(this, arguments)); }; }; var getScript = getSingle(function(){ return document.createElement('script'): }) var script1 = getScript(); var script2 = getScript(); console.log(script1 === script2);

December 7, 2022 · 1 min · 63 words · Andy Jia

Makedown Syntax

Introduction This is bold text, and this is emphasized text. Visit the Hugo website!

December 2, 2022 · 1 min · 14 words · Andy Jia

.ssh config

.ssh config info sample cat .ssh/config ServerAliveInterval 60 Host jp-1 HostName ip User ubuntu Port 22 IdentityFile ~/.ssh/cloud.key

1 min · 18 words · Andy Jia

deploy application on Ubuntu or Dockerfile

deploy on Ubuntu cd project-folder apt update apt install python3 python3-pip source venv/bin/activate pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com Dockerfile FROM ubuntu:focal COPY . /project-folder RUN apt-get update && apt-get install python3 python3-pip -y WORKDIR /project-folder RUN . venv/bin/activate RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN ./app1.sh

1 min · 52 words · Andy Jia

How To Create Drag and Drop Elements with Vanilla JavaScript and HTML

How To Create Drag and Drop Elements with Vanilla JavaScript and HTML

1 min · 12 words · Andy Jia