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
/** | |
* @fileoverview | |
* - Using the 'QRCode for Javascript library' | |
* - Fixed dataset of 'QRCode for Javascript library' for support full-spec. | |
* - this library has no dependencies. | |
* | |
* @author davidshimjs | |
* @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> | |
* @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a> | |
*/ |
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 React, { PureComponent, createRef } from 'react'; | |
/** | |
* @class ExtendClickArea | |
* @argument {PureComponent<{ extend: number, center: boolean }>} | |
* @description 用来自动扩展按钮的点击区域 | |
**/ | |
export default class ExtendClickArea extends PureComponent { | |
/** @type {{ width: number, height: number }} */ | |
state = { width: 0, height: 0 }; |
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
type BaseEventMap = { [event: string]: [] } | |
type EventListener<EventMap extends BaseEventMap, Event extends keyof EventMap> | |
= (...args: EventMap[Event]) => any | |
type EventListenerItem<EventMap extends BaseEventMap, Event extends keyof EventMap> = { | |
once: boolean | |
listener: EventListener<EventMap, Event> | |
} |
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
/* eslint-disable */ | |
/* | |
一套基于 postMessage 的页面间通讯协议 | |
*/ | |
/* | |
interface Request { | |
id: number | |
type: 'req' |
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 throttle<R>(func: () => Promise<R>): () => Promise<R> { | |
let promise: Promise<R> | null = null | |
return () => { | |
if (promise) { | |
return promise | |
} else { | |
promise = func() | |
promise.finally(() => promise = null) | |
return promise | |
} |
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 { template } = require('./template') | |
function setEnv(env, paris) { | |
for (const [name, value] of Object.entries(paris)) { | |
let get | |
if (typeof value === 'string') { |
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 { escape } = require('mysql') | |
function escapeValue(value) { return escape(value) } | |
function escapeName(name) { return '`' + name + '`'; } | |
// ================ export ================ | |
function $limit(nu) { | |
return `LIMIT ${escapeValue(nu)}` |
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 startup(zone, module_path) { | |
const code | |
= "eval((function () {" | |
+ " var path = require('path');" | |
+ " var startup_module_path = " + JSON.stringify(module_path) + ";" | |
+ " var startup_module = require(startup_module_path);" | |
+ " var startup_code = Object" | |
+ " .getOwnPropertyNames(startup_module)" | |
+ " .map(function (name) { return { name: name, value: startup_module[name] }; })" | |
+ " .reduce(function (prev, curr) {" |
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
if (pbpaste | grep -Eq '^cd "[^"]*" && sh "[^"]*/site_publish_logs/sh_\d*\.sh" && open "[^"]*"') | |
then | |
echo "========== MWEB AUTO PUBLISH START ==========" | |
echo "Runing command:" | |
pbpaste | |
if pbpaste | sh | |
then | |
echo "Success!" |
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
#!/usr/bin/env node | |
const fs = require('fs') | |
const path = require('path') | |
const [, , ...argv] = process.argv | |
const create_body_flag = argv.filter(key => key === '-b').length > 0 | |
const classes = argv.filter(key => key !== '-b') | |
const warpNamespace = (namespaces, content) => { |