Skip to content

Instantly share code, notes, and snippets.

View sunzsh's full-sized avatar

小山 sunzsh

View GitHub Profile
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* @author sunzsh
* @param <T> 延迟业务数据的类型
*/
@sunzsh
sunzsh / fix-zoom.js
Created December 29, 2023 15:37
解决代码修改了网页zoom导致各种popover错位的问题(适配vue2+elementUI)
export default {
install(Vue) {
const delegates = {
'el-select': (component, element) => {
return [component.$refs.reference.$el]
},
'el-pagination': (component, element) => {
const sizesComponent = component.$children.find((child) => child.$options._componentTag === 'sizes');
const eles_ElSelectInSizes = delegates['el-select'](sizesComponent.$children[0], element);
@sunzsh
sunzsh / 系统当前选中文件路径.applescript
Last active December 7, 2023 06:20
alfred获取当前选中的文件路径
on run
tell application "Finder" to set aliasItemName to selection as alias
set posixPathName to POSIX path of aliasItemName
return posixPathName
end run
@sunzsh
sunzsh / gist:e66cbef4f43820a5c2007d5c747c9529
Last active November 9, 2023 15:20
书签栏免登陆复制CSDN博客中代码片段
javascript:$('#content_views').unbind('copy');csdn.copyright.textData='';document.querySelectorAll(".prism,.hljs-button").forEach((b)=>{b.setAttribute('data-title','\u590d\u5236');b.onclick=function(e){navigator.clipboard.writeText(e.target.parentElement.innerText);e.stopPropagation();e.target.setAttribute('data-title','\u590d\u5236\u6210\u529f');setTimeout(()=>{e.target.setAttribute('data-title','\u590d\u5236');},2000)}});document.querySelectorAll("style").forEach((s)=>{if((s.innerText||"").indexOf('#content_views pre')>-1){s.parentElement.removeChild(s)}});
"editor.renderFinalNewline": "dimmed",
"workbench.colorCustomizations": {
"editorLineNumber.foreground": "#222",
"editorLineNumber.activeForeground": "#666",
"editorLineNumber.dimmedForeground": "#111",
"editorIndentGuide.background": "#222",
"editorIndentGuide.activeBackground": "#666",
"editor.lineHighlightBackground": "#111", //修改光标所在行的背景色
"editor.lineHighlightBorder": "#333", //修改光标所在行的边框色
"editor.wordHighlightBorder": "#e4893995"
javascript:(function(){document.querySelector('.hide-article-pos').remove();document.querySelector('.article_content').style.height='initial';})()
@sunzsh
sunzsh / v-drag.js
Created December 1, 2022 13:43
v-drag指令
Vue.directive('drag', (el) => {
const oDiv = el // 当前元素
const minTop = oDiv.getAttribute('drag-min-top')
const ifMoveSizeArea = 20
oDiv.onmousedown = e => {
let target = oDiv
while (window.getComputedStyle(target).position !== 'absolute' && target !== document.body) {
target = target.parentElement
}
@sunzsh
sunzsh / el-table3.vue
Last active June 19, 2023 05:51
带分页打印表头的el-table
<script>
import { Table } from 'element-ui';
export default {
extends: Table,
mounted() {
this.$nextTick(function () {
let thead = this.$el.querySelector('.el-table__header-wrapper thead');
let theadNew = thead.cloneNode(true);
this.$el.querySelector('.el-table__body-wrapper table').appendChild(theadNew);
})
@sunzsh
sunzsh / gist:874d2e5e214a660fd5b8f75fea0a5b5a
Last active May 24, 2023 14:53
react文本框赋值方法
javascript:(function(){setNativeValue=function(qs,value){const element=document.querySelector(qs);const valueSetter=Object.getOwnPropertyDescriptor(element,'value').set;const prototype=Object.getPrototypeOf(element);const prototypeValueSetter=Object.getOwnPropertyDescriptor(prototype,'value').set;if(valueSetter&&valueSetter!==prototypeValueSetter){prototypeValueSetter.call(element,value)}else{valueSetter.call(element,value)}element.dispatchEvent(new Event('input',{bubbles:true}))};})();
<style>
@keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);