Skip to content

Instantly share code, notes, and snippets.

View Lruihao's full-sized avatar
🎯
I may be slow to respond.

Cell Lruihao

🎯
I may be slow to respond.
View GitHub Profile
@Lruihao
Lruihao / git-summary.md
Last active January 10, 2024 02:14
Git 统计代码量

统计 commit 数

git log --author="1024@lruihao.cn" --since="2023-01-01" --until="2023-12-31" --oneline | wc -l

统计行数

git log --author="1024@lruihao.cn" --pretty=tformat:  --since="2023-01-01" --until="2023-12-31" --numstat -- .  ":(exclude)build" ":(exclude)dist" ":(exclude)node_modules" ":(exclude)test" ":(exclude)static" -numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
@Lruihao
Lruihao / utils.js
Created July 3, 2023 01:43
common utils
/**
* 单词首字母小写
* @param {String} str 字符串
* @returns
*/
export function firstLowerCase(str) {
return str.replace(/^\S/, s => s.toLowerCase())
}
/**
* 单词首字母大写
@Lruihao
Lruihao / gen-router.js
Created June 19, 2023 06:13
自动生成 Vue 路由
const fs = require('fs')
const os = require('os')
const vueDir = './src/views/'
const routerFile = './src/router.js'
fs.readdir(vueDir, function (err, files) {
if (err) {
console.error(' Could not list the directory.', err)
return