Skip to content

Instantly share code, notes, and snippets.

View aliuq's full-sized avatar

AliuQ aliuq

View GitHub Profile
@aliuq
aliuq / build.config.ts
Last active January 7, 2025 03:41
JS build method
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
entries: ['./src/index'],
sourcemap: true,
rollup: {
emitCJS: true,
esbuild: {
minify: true,
},
@aliuq
aliuq / use-python-venv.sh
Last active October 27, 2024 16:50
为 python 项目使用虚拟环境
# 在项目根目录下添加一个虚拟环境 venv
python3 -m venv venv
# 激活虚拟环境
source venv/bin/activate
# 在虚拟环境下安装依赖,依赖隔离
pip install -r requirement.txt
# 退出虚拟环境
deactivate
@aliuq
aliuq / format.ts
Created October 15, 2022 22:42
Format function
/** 格式化日期时间
*
* 占位符说明: {@link https://day.js.org/docs/zh-CN/display/format 参考 dayjs}
*
* @example
* ```ts
* const now = new Date()
* formatDateTime(now, 'YYYY-MM-DD HH:mm:ss') // 2022-10-16 12:00:00
* formatDateTime(now, 'YYYY年MM月DD日 星期dd HH:mm:ss') // 2022年10月16日 星期日 12:00:00
* formatDateTime(now, 'YYYY-MM-DD 第Q季度 第ww周') // 2022-10-16 第4季度 第43周
@aliuq
aliuq / cf-get-public-ip.js
Created July 26, 2022 10:43
return your request public ip address
async function handleRequest(request) {
const ip = request.headers.get("cf-connecting-ip")
return new Response(ip, {status: 200})
}
addEventListener('fetch', event => {
return event.respondWith(handleRequest(event.request))
})
@aliuq
aliuq / emojis.json
Created December 18, 2017 15:23 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "👩‍👩‍👧‍👧", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "👩‍👩‍👧‍👦", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "👩‍👩‍👦‍👦", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "👨‍👩‍👧‍👧", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "👨‍👩‍👧‍👦", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "👨&zw