Skip to content

Instantly share code, notes, and snippets.

View banyudu's full-sized avatar
🎯
Focusing

Yudu banyudu

🎯
Focusing
View GitHub Profile
@banyudu
banyudu / star.blog.md
Created January 22, 2024 02:11
Introducing S.T.A.R as an alternative to S.M.A.R.T objective definition

Introducing S.T.A.R as an alternative to S.M.A.R.T objective definition.

Let's start by reviewing what S.M.A.R.T stands for:

  1. S: Specific
  2. M: Measurable
  3. A: Achievable
  4. R: Relevant
  5. T: Time-bound
@banyudu
banyudu / ts-truthy-falsy.ts
Created December 18, 2023 09:02
Typescript truthy falsy guard
export const truthy = (v: any): v is true => {
return !!(v as boolean)
}
export const falsy = (v: any): v is false => {
return !(v as boolean)
}
@banyudu
banyudu / chrome-extension-development.blog.md
Created November 7, 2023 11:57
Chrome插件开发浅浅谈
  • 浅谈Chrome插件开发

  • 可能有很多人都用过Chrome插件,有没有好奇过Chrome插件是怎么开发的?

  • Chrome插件开发使用到的技术栈并不复杂,也是 HTML/CSS/JS 这些前端相关的技术,只是会有一套自己的 API 和限制等,下面带大家认识下 Chrome 插件的开发。

  • 插件是什么?

    • image
  • 插件怎么开发?

    • 原始阶段(类似于手动操作dom)
  • 引入各个浏览器(主要是Firefox)的sdk,调用sdk开发浏览器专用的插件

@banyudu
banyudu / git-blame-all
Last active April 12, 2023 02:24
Generate git commit sha for every line of code in given file
#!/bin/bash
# Check if a filename was provided as an argument
if [ -z "$1" ]; then
echo "Usage: git blame-all filename"
exit 1
fi
# Loop through each line of the given file and run git blame
line_number=1
@banyudu
banyudu / .npmrc
Last active February 6, 2024 12:03
.npmrc for China users
sass_binary_site=https://cdn.npmmirror.com/binaries/node-sass
disturl=https://registry.npmmirror.com/dist
profiler_binary_host_mirror=https://cdn.npmmirror.com/binaries/node-inspector/
fse_binary_host_mirror=https://cdn.npmmirror.com/binaries/fsevents/
phantomjs_cdnurl=https://cdn.npmmirror.com/binaries/phantomjs/
electron_mirror=https://cdn.npmmirror.com/binaries/electron/
chromedriver_cdnurl=https://cdn.npmmirror.com/binaries/chromedriver
operadriver_cdnurl=https://cdn.npmmirror.com/binaries/operadriver
selenium_cdnurl=https://cdn.npmmirror.com/binaries/selenium
node_inspector_cdnurl=https://cdn.npmmirror.com/binaries/node-inspector
@banyudu
banyudu / useTranslation.ts
Created June 11, 2022 10:06
useTranslation based on ProjectBundle
import { useCallback, useEffect, useState } from 'react'
import { FluentBundle, FluentResource } from '@fluent/bundle'
import { negotiateLanguages } from "@fluent/langneg";
import axios from 'axios'
const LOCALES_ALL = ['zh-CN', 'en-US']
async function getBundle (locale: string): Promise<FluentBundle> {
const url = `/locale/${locale}.ftl` // fluent bundle file location
const response = await axios.get(url)
@banyudu
banyudu / react-spam-issue-to-the-politics-of-technology.blog.md
Last active August 29, 2023 10:26
从React骂战看技术的政治性

从React骂战看技术的政治性

wheat field

3月3日晚,我在 Twitter 上注意到有一些关于 React 的 Github 仓库出现 issue 骂战的消息,同时一些微信群中也开始转发这个消息。

@banyudu
banyudu / modern-css.blog.md
Created February 18, 2022 06:44
现代化的CSS

现代化的 CSS

CSS

什么是现代化的CSS?

@banyudu
banyudu / zx-introduction.blog.md
Created December 30, 2021 08:19
zx - 面向前端的Shell编程利器

zx - 面向前端的Shell编程利器

Shell 简介

Shell,或者说命令行,对于处理工作中遇到的重复性工作有极大的帮助。

@banyudu
banyudu / debug-frontend-app-with-proxy.blog.md
Last active November 24, 2021 07:04
前端调试之网络代理

前端调试之网络代理

说到前端调试,脑海中是不是自然地就想到了源代码,想到开发环境等等概念?

它们是必需的吗?