Skip to content

Instantly share code, notes, and snippets.

View zxhfighter's full-sized avatar
🏠
Working from home

ski zxhfighter

🏠
Working from home
View GitHub Profile
@zxhfighter
zxhfighter / fork-and-push.md
Last active April 14, 2024 10:04
如何给开源项目贡献代码

如何给开源项目贡献代码

分两种情况:

  • 代码仓库管理者给你添加该仓库的写入权限,这样的话可以直接push
  • 如果不能直接push(大多数情况),采用经典的fork & pull request来提交代码,下面讲述这种情况

fork & pull request

例如有个仓库https://github.com/ecomfe/esui.git,其采用了经典的分支开发模型,稳定后的代码提交到master分支,其余特性则在dev分支上进行开发,待成熟后合并回master分支。

@zxhfighter
zxhfighter / localhost.md
Last active March 30, 2023 08:12
127.0.0.1 和 0.0.0.0 的区别

127.0.0.1、localhost、0.0.0.0、本机IP地址

localhost

首先,localhost 就是一个域名,域名指向 127.0.0.1,两者是一样的,如果是 mac,可以在 /etc/hosts 文件中看到这一行。

127.0.0.1     localhost
@zxhfighter
zxhfighter / mac-ffmpeg.md
Last active March 9, 2022 03:25
mac 安装 ffmpeg

直接安装

brew install ffmpeg

如果需要安装第三方 options,可以如下操作:

1.执行

@zxhfighter
zxhfighter / angular-cli-hmr.md
Last active July 4, 2021 13:26
angular-cli 添加 hmr 热加载

如何使 angular-cli 支持 hmr 热加载

angular-cli 提供了 live-reload 功能,但是在较大型项目中,任何地方一个微小的改动,都会触发浏览器的 live-reolad,这样又会重新加载几百个文件,至少需要 5s+ 以上的时间。

搜索 angular-cli 的 issues 关键词,找到了解决方案。

该解决方案参考了 这篇文章

第一步

@zxhfighter
zxhfighter / nginx-405.md
Last active May 27, 2021 14:55
Nginx将静态文件响应POST请求,提示405错误问题

Nginx的405错误

绝大多数服务器,都不允许静态文件响应POST请求(GET请求静态文件是天经地义的),否则会返回HTTP/1.1 405 Method not allowed错误。

然而在前端开发中,前端开发工程师经常模拟后端请求,返回静态数据来查看页面效果,怎么办?

目前有两种方案解决:

方案一:修改配置文件nginx.conf(推荐

@zxhfighter
zxhfighter / tar-exclude.md
Last active April 9, 2021 06:52
using `--exclude` in tar command

Mac 下打包排除目录,--exclude 参数必须紧跟在 tar 命令后边,否则不会生效。

tar --exclude="*.pkg" --exclude=".git" --exclude="node_modules*" -cvzf weirwood-node.tar.gz weirwood-node/

tar --exclude="*.pkg" --exclude="dist" --exclude="upload-files"  --exclude="log" --exclude="upload-files-source" --exclude="sourcemap-cache" --exclude=".git" --exclude="node_modules*" -cvzf weirwood-node.tar.gz weirwood-node/
@zxhfighter
zxhfighter / git-ignore.md
Last active March 20, 2021 09:36
git ignore

.gitignore

有些文件我们不想纳入管理,也不希望它们总出现在未跟踪列表,例如一些开发依赖,编译日志等等。我们可以创建一个.gitignore的文件,列出需要忽略的文件模式。

格式规范

  • 空行或者以注释符号#开头的行会被忽略
  • 标准的glob模式匹配
  • 匹配模式最后跟反斜杠(/)说明要忽略的是目录
  • 要忽略指定模式以外的文件和目录,可以在模式前加上惊叹号(!)取反