This file contains 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
const { createReadStream, createWriteStream } = require('fs'); | |
const tar = require(tar); | |
const dest = process.cwd(); | |
// A: remote download | |
// A1: use lib | |
let res = await axios.get(url, { | |
responseType: 'stream' | |
}); | |
let writer1 = createWriteStream(dest, { |
This file contains 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
const http = require('http'); | |
let server; | |
function onRequest(req, res) { | |
console.log('[' + this.name + ']', req.method, req.url); | |
res.setHeader('Access-Control-Allow-Origin', '*'); | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
} |
This file contains 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://eslint.org/docs/user-guide/configuring | |
/* | |
* 0 - off | |
* 1 - warn | |
* 2 - error | |
*/ | |
module.exports = { | |
extends: "eslint:recommended", | |
parser: "@typescript-eslint/parser", | |
parserOptions: { |
This file contains 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
/* 切换滚动条页面闪动 */ | |
html { | |
overflow-y: scroll; | |
} | |
:root { | |
overflow-y: auto; | |
overflow-x: hidden; | |
} |
This file contains 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
<template> | |
<div class="text-ellipsis" :style="{height: textHeight,lineHeight: lineHeight}"> | |
<div class="ellipsis-before" :style="{height: textHeight}"></div> | |
<div class="ellipsis-content"> | |
<template v-if="$slots.default"> | |
<slot></slot> | |
</template> | |
<template v-else>{{text}}</template> | |
</div> | |
<div class="ellipsis-after" :style="{top: '-'+lineHeight, height: lineHeight}">...</div> |
This file contains 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
#!/usr/bin/env bash | |
set -euxo pipefail # 抛出异常 | |
dd # 删除一行 | |
yy # 复制一行 | |
p # 粘贴 | |
cp Filename newFilename # 复制文件 | |
ctrl+d # 向下翻半页 | |
echo $diff_info | awk -F "[version]" '{print $0}' |
This file contains 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
/** | |
* 正则字符串去重 | |
* | |
* @param {string} str —— 需要去重的字符串 | |
* @returns | |
*/ | |
function clearRepeat(str) { | |
let regex = /(.)?/g; | |
return str.replace(regex, function($1, $2, $3, $4) { | |
return $4.indexOf($2) === $3 ? $2 : ''; |
This file contains 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
var express = require('express'); | |
var app = express(); | |
app.use(express.static('dist')); | |
//设置跨域访问 | |
app.all('*', function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS"); |
This file contains 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
/* 绘制坐标系 | |
* scene —— 要绘制坐标系的场景(let scene = new THREE.Scene()) | |
*/ | |
function drawCoordSystem(scene) { | |
// 创建三个坐标轴的几何模型 | |
let geometryX = new THREE.Geometry(); | |
geometryX.vertices.push( | |
new THREE.Vector3(-5, 0, 0), | |
new THREE.Vector3(5, 0, 0), | |
new THREE.Vector3(4.8, 0.2, 0) |
NewerOlder