Skip to content

Instantly share code, notes, and snippets.

View yinxin630's full-sized avatar
😊
All is well

碎碎酱 yinxin630

😊
All is well
View GitHub Profile
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';
@yinxin630
yinxin630 / webrtc-sender.html
Last active August 16, 2019 09:03
|-|&tag=code
<!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" />
@yinxin630
yinxin630 / webrtc-reveiver.html
Last active August 16, 2019 09:03
|-|&tag=code
<!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>
@yinxin630
yinxin630 / inobounce.js&env=plain
Last active August 16, 2019 09:00
ios橡皮筋效果问题|-|&tag=code
/**
* 阻止目标元素下不必要的滚动事件. 解决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) {
@yinxin630
yinxin630 / goHome.js
Last active August 16, 2019 09:00
|-|&tag=code
// 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);
@yinxin630
yinxin630 / tsconfig.json&env=plain
Created July 12, 2019 01:45
tsconfig.json|-|&tag=常用工具配置
{
"compilerOptions": {
"target": "es5",
"strict": true,
"module": "es2015",
"moduleResolution": "node",
"experimentalDecorators": true,
"jsx": "react",
"types": ["react", "react-dom", "redux", "react-redux"],
"allowSyntheticDefaultImports": true,
@yinxin630
yinxin630 / .eslintrc&env=plain
Created July 11, 2019 12:00
|-|&tag=常用工具配置
{
"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"],
@yinxin630
yinxin630 / fiora-nami-link-robot.js&env=plain
Last active August 16, 2019 09:01
fiora-nami联通机器人|-|&tag=code
@yinxin630
yinxin630 / .prettirerc&env=plain
Last active July 1, 2019 03:36
推荐配置|-|&tag=常用工具配置
{
"tabWidth": 4,
"trailingComma": "all",
"singleQuote": true,
"arrowParens": "always",
"printWidth": 100
}
@yinxin630
yinxin630 / cloudSettings
Last active March 4, 2021 05:51
vscode-config|-|&tag=vscode-setting-sync
{"lastUpload":"2020-11-07T14:52:08.803Z","extensionVersion":"v3.4.3"}