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 licenseData from './license.json' assert { type: 'json'} | |
import fs from 'node:fs' | |
let store = new Map() | |
Object.entries(licenseData).forEach(([name, data]) => { | |
const { licenses } = data | |
if (store.has(licenses)) { | |
store.get(licenses).push(name) | |
} else { | |
store.set(licenses, [name]) |
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
#![feature(prelude_import)] | |
#[prelude_import] | |
use std::prelude::rust_2021::*; | |
#[macro_use] | |
extern crate std; | |
#[macro_use] | |
extern crate napi_derive; | |
use napi::bindgen_prelude::*; | |
pub struct Foo {} | |
impl napi::bindgen_prelude::TypeName for Foo { |
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
const HandlerID = Symbol() | |
export function defineEvent(obj, name) { | |
const handlers = new Set() | |
const fn = function () { | |
for (const handler of handlers) { | |
try { | |
handler() | |
} catch (e) { | |
Promise.reject(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
/** | |
* 获取 promise 的 tuple | |
* | |
* @export | |
* @template T | |
* @template R | |
* @param promise 需要获取结果的 promise 对象 | |
* @returns {(Promise<[R] | [null, 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
/** | |
* some insane hack, just want to avoid using expensive parser. | |
*/ | |
export function getFreeVariables(expr:string, knownSymbols:Record<string,unknown>){ | |
const freeVariables = new Set<string>(); | |
//eslint-disable-next-line | |
const anyThingPrimitive = ()=>{}; |
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
/** | |
* 重置 Vue 组件的数据 | |
* @param {Vue} instance | |
*/ | |
export function resetVueData(instance: Vue): void { | |
Object.assign(instance.$data, (instance.$option.data as any).call(instance)) | |
} |
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 * as React from "react" | |
import { BehaviorSubject } from 'rxjs'; | |
const ERROR_DETAIL = Symbol("errors") | |
const HAS_ERROR = Symbol("has error") | |
const InternalSymbolKeys = [ERROR_DETAIL,HAS_ERROR] | |
enum FieldType { | |
arrayItem, |
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
export function formatAmountCapitalized(n) { | |
let fraction = ['角', '分']; | |
let digit = [ | |
'零', '壹', '贰', '叁', '肆', | |
'伍', '陆', '柒', '捌', '玖' | |
]; | |
let unit = [ | |
['元', '万', '亿'], | |
['', '拾', '佰', '仟'] | |
]; |
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 sleep(d){ | |
for(var t = Date.now();Date.now() - t <= d;); | |
} | |
sleep(5000); //当前方法暂停5秒 |
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
// 无root拉起钉钉打卡 | |
var a = app.intent({ | |
action: "VIEW", | |
data: "dingtalk://dingtalkclient/page/link?url=https://attend.dingtalk.com/attend/index.html" | |
}); | |
app.startActivity(a); | |
//需要用到root权限 否则打不开 | |
var TimeStamp = Math.round(new Date()); | |
var corpId = ""; //自己想办法获取公司的ID ding开头的一串码 |
NewerOlder