Skip to content

Instantly share code, notes, and snippets.

View xhsdnn's full-sized avatar

xhsdnn xhsdnn

  • beijing
View GitHub Profile
#!/usr/bin/env bash
set -euxo pipefail # 抛出异常
dd # 删除一行
yy # 复制一行
p # 粘贴
cp Filename newFilename # 复制文件
ctrl+d # 向下翻半页
echo $diff_info | awk -F "[version]" '{print $0}'
@xhsdnn
xhsdnn / TextEllipsis.vue
Created August 9, 2019 08:35
单/多行文本截断的vue组件
<template>
<div class="text-ellipsis" :style="{height: textHeight,lineHeight: lineHeight}">
<div class="ellipsis-before" :style="{height: textHeight}"></div>
<div class="ellipsis-content">
<template v-if="$slots.default">
<slot></slot>
</template>
<template v-else>{{text}}</template>
</div>
<div class="ellipsis-after" :style="{top: '-'+lineHeight, height: lineHeight}">...</div>
/* 切换滚动条页面闪动 */
html {
overflow-y: scroll;
}
:root {
overflow-y: auto;
overflow-x: hidden;
}
// https://eslint.org/docs/user-guide/configuring
/*
* 0 - off
* 1 - warn
* 2 - error
*/
module.exports = {
extends: "eslint:recommended",
parser: "@typescript-eslint/parser",
parserOptions: {
const http = require('http');
let server;
function onRequest(req, res) {
console.log('[' + this.name + ']', req.method, req.url);
res.setHeader('Access-Control-Allow-Origin', '*');
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}
const { createReadStream, createWriteStream } = require('fs');
const tar = require(tar);
const dest = process.cwd();
// A: remote download
// A1: use lib
let res = await axios.get(url, {
responseType: 'stream'
});
let writer1 = createWriteStream(dest, {
@xhsdnn
xhsdnn / big-red-button.css
Last active April 16, 2024 11:53
按钮按下触感样式
/*
* reference: https://learn.svelte.dev/tutorial/dom-event-forwarding
*/
button {
font-size: 1.4em;
width: 6em;
height: 6em;
border: none;
border-radius: 50%;
background: radial-gradient(circle at 25% 25%, hsl(0, 100%, 50%) 0, hsl(0, 100%, 40%) 100%);