Skip to content

Commit ec92edf

Browse files
author
Your Name
committed
add code lib
1 parent 616f641 commit ec92edf

7 files changed

Lines changed: 562 additions & 410 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ShortX Repo
22

3-
这是ShortX发现页面的在线指令数据仓库,指令更新时,通过Github Action自动创建PR更新Index文件。
3+
这是ShortX发现页面的在线一键指令、自动指令和代码库数据仓库,内容更新时,通过Github Action自动创建PR更新Index文件。
44

55
[![Update index](https://github.com/ShortX-Repo/ShortX-Files/actions/workflows/update_index.yml/badge.svg)](https://github.com/ShortX-Repo/ShortX-Files/actions/workflows/update_index.yml)
66

@@ -19,16 +19,20 @@
1919

2020
`index.json`
2121

22-
这是指令的索引文件,记录了所有一键指令和自动指令的基础信息以及其url
22+
这是索引文件,记录了所有一键指令、自动指令和代码库的基础信息以及其url
2323

2424
`da`
2525

2626
这是放一键指令的目录,每个指令对应一个文件,可以通过App分享功能直接生成文件。
2727

28-
`rules`
28+
`rule`
2929

3030
这是放自动指令的目录,每个指令对应一个文件,可以通过App分享功能直接生成文件。
3131

32+
`code`
33+
34+
这是放代码库的目录,每个代码库对应一个文件。可以通过App里的代码库分享功能导出,再按需调整内容。
35+
3236

3337
## 版本控制
3438

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "CODELIB-7a1f2b44-3d8e-4eb3-a8f7-12fd9fb9a202",
3+
"name": "JavaScript 文本工具箱",
4+
"description": "常用字符串拼接和时长格式化函数示例。",
5+
"type": "CodeType_JAVASCRIPT",
6+
"content": "function joinNotBlank(list, sep) {\n var out = [];\n if (!list) return \"\";\n for (var i = 0; i < list.length; i++) {\n var value = list[i];\n if (value !== null && value !== undefined) {\n var text = String(value).trim();\n if (text.length > 0) {\n out.push(text);\n }\n }\n }\n return out.join(sep || \", \");\n}\n\nfunction formatDuration(ms) {\n var total = Math.max(0, Math.floor((ms || 0) / 1000));\n var hours = Math.floor(total / 3600);\n var minutes = Math.floor((total % 3600) / 60);\n var seconds = total % 60;\n var parts = [];\n if (hours > 0) parts.push(hours + \"h\");\n if (minutes > 0) parts.push(minutes + \"m\");\n parts.push(seconds + \"s\");\n return parts.join(\" \");\n}",
7+
"createdAt": "1773888000000",
8+
"updatedAt": "1773888000000",
9+
"tags": [
10+
"example",
11+
"javascript",
12+
"text"
13+
]
14+
}
15+
###------###
16+
{"type":"CodeLibraryItem","author":"ShortX"}

code/Code-MVEL_时间工具箱.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "CODELIB-5c35b1d2-0f1d-4ef9-9c75-6b2e4d2fa101",
3+
"name": "MVEL 时间工具箱",
4+
"description": "时间戳、当天开始时间、常用时间格式转换示例。",
5+
"type": "CodeType_MVEL",
6+
"content": "def formatTime(millis, pattern) {\n sdf = new java.text.SimpleDateFormat(pattern == null ? \"yyyy-MM-dd HH:mm:ss\" : pattern);\n return sdf.format(new java.util.Date(millis));\n}\n\ndef nowText() {\n return formatTime(System.currentTimeMillis(), \"yyyy-MM-dd HH:mm:ss\");\n}\n\ndef startOfDay(millis) {\n cal = java.util.Calendar.getInstance();\n cal.setTimeInMillis(millis == null ? System.currentTimeMillis() : millis);\n cal.set(java.util.Calendar.HOUR_OF_DAY, 0);\n cal.set(java.util.Calendar.MINUTE, 0);\n cal.set(java.util.Calendar.SECOND, 0);\n cal.set(java.util.Calendar.MILLISECOND, 0);\n return cal.getTimeInMillis();\n}",
7+
"createdAt": "1773888000000",
8+
"updatedAt": "1773888000000",
9+
"tags": [
10+
"example",
11+
"mvel",
12+
"time"
13+
]
14+
}
15+
###------###
16+
{"type":"CodeLibraryItem","author":"ShortX"}

0 commit comments

Comments
 (0)