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
function clone(obj) { | |
if ((typeof (obj) == "object") && (obj != null)) { | |
if (obj instanceof Array) { | |
//如果是Array | |
let newObj = []; | |
for (let i = 0; i < obj.length; i++) { | |
if (typeof (obj[i]) == "object") { | |
newObj[i] = clone(obj[i]); | |
} else { | |
newObj[i] = obj[i]; |
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
vi ~/.bash_profile | |
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home | |
export JAVA_9_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home | |
export JAVA_HOME=$JAVA_8_HOME | |
source ~/.bash-profile |
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
git init # 初始化本地git仓库(创建新仓库) | |
git config --global user.name "xxx" # 配置用户名 | |
git config --global user.email "[email protected]" # 配置邮件 | |
git config --global color.ui true # git status等命令自动着色 | |
git config --global color.status auto | |
git config --global color.diff auto | |
git config --global color.branch auto | |
git config --global color.interactive auto | |
git config --global --unset http.proxy # remove proxy configuration on git | |
git clone git+ssh://[email protected]/VT.git # clone远程仓库 |
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 webpack = require("webpack") | |
module.exports = { | |
baseUrl: "/", | |
outputDir: "dist", | |
// 打包之后静态资源保存的目录 | |
assetsDir: "assets", | |
// 配置多页引用的入口 | |
pages: { | |
index: "src/main.js", |
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 webpack = require("webpack"); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
baseUrl: "/", | |
outputDir: "dist", | |
// 打包之后静态资源保存的目录 | |
assetsDir: "assets", | |
// 配置多页引用的入口 | |
pages: { |
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 gulp = require("gulp"); | |
const spritesmith = require("gulp.spritesmith"); // https://github.com/twolfson/gulp.spritesmith | |
const imagemin = require('gulp-imagemin'); | |
const concat = require('gulp-concat'); | |
const uglify = require('gulp-uglify'); | |
const rename = require('gulp-rename'); | |
const sass = require('gulp-sass'); | |
// 默认任务 | |
gulp.task('default', function () { |
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
/* 前提需要先引入three.js | |
* n —— 正多边形边数 | |
* r —— 正多边形所在外接圆的半径 | |
* cx —— 正多边形所在外接圆的圆形X轴坐标(默认为:0) | |
* cy —— 正多边形所在外接圆的圆形Y轴坐标(默认为:0) | |
*/ | |
function drawPolygon(n ,r, cx = 0, cy = 0) { | |
let vertexs = []; | |
for(let i=0; i<n; i++) { | |
let x = cx + r*Math.sin(2*Math.PI/n*i); |
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) |
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
/** | |
* 正则字符串去重 | |
* | |
* @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 : ''; |
OlderNewer