centos安装nvm
安装nvm(node包管理工具)github
安装以下两个都可以选一个即可
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
重启生效source .bashrc
centos安装pyenv
安装pyenv(python包管理工具)github
参考链接
如果还没安装git(安装则忽略)yum install git
安装curl https://pyenv.run | bash
设置环境变量echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrcecho 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrcecho -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrcecho 'export PATH="$PYENV_ROOT/shims:$PATH"' >> ~/.bashrc
重启生效source .bashrc
安装编译 ...
如何实现文本溢出后文本无缝滚动
碰到个及其恶心的需求,需要文本溢出后水平滚动但是还要无缝;
辅助函数/** * @text:文本 * @size:字体大小 */export const getTextWidth = (text: string, size: number) => { const span = document.createElement('span'); span.style.position = 'absolute'; // 避免影响页面布局 span.style.visibility = 'hidden'; // 隐藏元素 span.style.whiteSpace = 'nowrap'; // 防止换行 span.style.fontSize = size + 'px'; // 设置字体和大小 span.textContent = text; document.body.appendChild(span); const width = span.offsetWidt ...
strapi常用操作
strapi 其他操作相关帖子参考 相关
api注册
http://localhost:1337/api/auth/local/register
代码演示
var myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");var raw = JSON.stringify({ "username": "test_2", "email": "22@qq.com", "password": "123456"});var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};fetch("http:// ...
Homebrew国内如何自动安装(国内地址)(Mac OS)
Homebrew国内如何自动安装(国内地址)(Mac OS)安装脚本*(终端中粘贴下方命令回车)*:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
卸载脚本:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
CSS实现圆环进度条
静态进度条<template> <div class="circle"> <div class="circle_left ab" :style="renderLeftRate(85)"></div> <div class="circle_right ab" :style="renderRightRate(85)"></div> <div class="circle_text"> <span class="name">成功率</span> <span class="value">85%</span> </div> </div></template>< ...
如何优雅的更改node_modules的源码
配置步骤:
安装 patch-package 和 postinstall-postinstall:
你需要确保已经安装了 patch-package 和 postinstall-postinstall,以处理在安装依赖时自动应用补丁的工作。
yarn add patch-package postinstall-postinstall
或者使用 npm:
npm install patch-package postinstall-postinstall
修改 node_modules 中的文件:直接在 node_modules 中找到你需要修改的包并进行修改。
生成补丁:在修改完成后,运行以下命令来生成补丁文件:
npx patch-package [package-name]
例如,如果你修改了 react-native-daterange-picker,命令应该是:
npx patch-package react-native-daterange-picker
这会在你的项目根目录中创建一个 patches 文件夹,里面存放了补丁文件。
在 package.json 中添加 ...
JS实现烟花特效
JS实现一个烟花特效效果如下
js代码如下window.addEventListener("resize", resizeCanvas, false);// window.addEventListener("DOMContentLoaded", openFlower, false);window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); };var canvas, ctx, w, h, particles = [], probabi ...
js实现将多张图片合成gif
我们要用到Gif.js这个插件官方仓库
官方示例
个人参考demo
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> </head> <body> <img id="outputGif" src="" /> <img src="./ani/1.png" alt="" /> </body></html><script src="./gif.js"& ...
小程序中如何将将图片下方加上文字并保存
我们要做的就是在一个已有的图片url上加上想要的文字然后长按保存到手机我这里使用的是 Taro 的Vue3 大家可作为一个参考转为自己的代码
第一步先定义元素<canvas canvas-id="myCanvas" style="width:300px; height:330px;"></canvas>
重新绘制图片const drawCanvas = async() => { const ctx = Taro.createCanvasContext('myCanvas'); const imageSrc = '你的图片url'; // 下载图片到本地 const imageInfo = await Taro.downloadFile({ url: imageSrc, }).catch(err => console.error('下载图片失败:', err)) // 先填充整个画布为白色背景 c ...