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 default async function copyToClipboard(str: string) { | |
if (navigator?.clipboard) { | |
return navigator.clipboard.writeText(str); | |
} | |
if (document?.execCommand) { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>webrtc</title> | |
</head> | |
<body> | |
<input type="file" /> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>webrtc</title> | |
</head> | |
<body> | |
<script> |
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
/** | |
* 阻止目标元素下不必要的滚动事件. 解决ios橡皮筋效果问题 | |
* 需要滚动的元素需要添加 overflow-x/y: auto (务必为单方向) 和 -webkit-overflow-scrolling: touch 样式 | |
* @param {HTMLElement} targetElement 目标元素 | |
*/ | |
export default function inobounce(targetElement) { | |
let startX = 0; | |
let startY = 0; | |
function handleTouchStart(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
// npm i --save chalk draftlog | |
const chalk = require('chalk'); | |
require('draftlog').into(console); | |
function getLog() { | |
const now = new Date(); | |
const goHome = new Date(); | |
goHome.setHours(18); | |
goHome.setMinutes(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
{ | |
"compilerOptions": { | |
"target": "es5", | |
"strict": true, | |
"module": "es2015", | |
"moduleResolution": "node", | |
"experimentalDecorators": true, | |
"jsx": "react", | |
"types": ["react", "react-dom", "redux", "react-redux"], | |
"allowSyntheticDefaultImports": true, |
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
{ | |
"extends": "eslint-config-airbnb", | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"project": "./tsconfig.json" | |
}, | |
"env": { | |
"browser": true | |
}, | |
"plugins": ["@typescript-eslint", "react", "react-hooks", "jsx-a11y", "import", "vue"], |
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
// ==UserScript== | |
// @name Communicate | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @include http://fiora.suisuijiang.com/* | |
// @include http://cr.mdzzapp.com/* | |
// @grant unsafeWindow | |
// @run-at document-start |
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
{ | |
"tabWidth": 4, | |
"trailingComma": "all", | |
"singleQuote": true, | |
"arrowParens": "always", | |
"printWidth": 100 | |
} |
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
{"lastUpload":"2020-11-07T14:52:08.803Z","extensionVersion":"v3.4.3"} |