Install, build and debug a react native app in WSL2 (Windows Subsystem for Linux) and Ubuntu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 工具函数,用于打印错误信息并退出 | |
error_exit() { | |
echo "$1" 1>&2 | |
exit 1 | |
} | |
# 检查命令是否存在,如果不存在则尝试安装 | |
ensure_command() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"LOCKTOWER_REASON_SMART_63": { | |
"reason": 63, | |
"type": 1, | |
"reasonDesc": "", | |
"title": "该QQ帐号存在安全风险,已被安全保护。", | |
"description": "根据系统检测,该QQ帐号存在安全风险,已被安全保护。", | |
"eDescription": "根据系统检测,该QQ帐号存在安全风险,已被安全保护。", | |
"button": "申请立即解冻", | |
"link": "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { definePlugin, http } from 'kivibot' | |
export default definePlugin({ | |
name: 'sd', | |
version: '1.0.0', | |
setup(ctx) { | |
ctx.handle('message', async (e) => { | |
if (e.raw_message.startsWith('#sd ')) { | |
const hasRight = ctx.isOwner(e) || ctx.isAdmin(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @from antfu https://antfu.me/posts/destructuring-with-object-or-array | |
export function destructIt<T extends Record<string, unknown>, A extends readonly any[]>( | |
obj: T, | |
arr: A | |
): T & A { | |
const clone = { ...obj } | |
Object.defineProperty(clone, Symbol.iterator, { | |
enumerable: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sade from 'sade' | |
const kivi = sade('kivi') | |
kivi | |
.version('1.0.0') | |
.describe('cli for kivibot') | |
.option('-c, --config', 'Provide path to custom kivibot config', 'kivi.json') | |
kivi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isObject(obj: unknown): obj is Record<string, unknown> { | |
return typeof obj === 'object' && obj !== null | |
} | |
export function deepClone<T>(obj: T, cache: Map<unknown, unknown> = new Map()): T { | |
if (obj === null || typeof obj !== 'object') { | |
return obj | |
} | |
if (cache.has(obj)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rfdc from 'rfdc' | |
type Listener<T> = (snapshot: T) => void | |
interface State<T extends object> { | |
proxy: T | |
target: T | |
listeners: Set<Listener<T>> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let currentListener: Function | undefined = undefined | |
function createSignal<T>(initialValue: T) { | |
let value = initialValue | |
const subscribers = new Set<Function>() | |
const read = () => { | |
if (currentListener !== undefined) { | |
subscribers.add(currentListener) |
Thanks to @jogerj and @PrimeCicada for the method! Original script: https://gist.github.com/jogerj/0339e61a92e0de2e360c5212a94854e8
Open powershell, then copy paste this script:
Global:
NewerOlder