enquire.js
非我而当者,吾师也;是我而当者,吾友也;谄谀我者,吾贼也——荀子 分享一个在js中使用媒体查询的封装: https://github.com/WickyNilliams/enquire.js 我们只需要安装 1cnpm install enquire.js 即可像这样使用: 123456789101112131415161718192021enquire.register("screen and (max-width:1000px)", { match : function() {}, // OPTIONAL // If supplied, triggered when the media query transitions // *from an unmatched to a matched state* unmatch : function() {}, ...
移动端拖动滑块验证
夫唯不争,故天下莫能与之争——老子 之前写过拖动滑块验证 但是发现移动端拖不动了 因为移动端使用的是touch事件:https://developer.mozilla.org/zh-CN/docs/Web/API/TouchEvent 我们对其进行改造,通过获取其第一个触控点的坐标进行计算 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152&...
google、YouTube、Medium进度条
当一个男人偷走了你的妻子时,最好的报复是让他去赡养她——吉特里 这是一个目前25K stars的项目 github:https://github.com/rstacruz/nprogress 演示网址:http://ricostacruz.com/nprogress 进度条是浏览器上方的这个
idea跳转class文件
残酷连接着愚昧,狡诈紧随着天真——高尔基 这是我从朋友分享的一篇博客上学来的 123idea64$FileNameWithoutExtension$.class$OutputPath$/$FileDirRelativeToSourcepath$ 配置好后即可右键跳转 我这里配置一个快捷键:CTRL+ALT+B 还挺好用的!
jackson反序列化器获取类型
不要用陌生人的目光来看你所爱的人,也不要认为自己做出了牺牲——贝·列昂尼多娃 例如这里使用hutool的EnumUtil.getEnumAt传入枚举的ordinal,以及枚举类型,获取到具体的枚举常量值 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106import cn.hutool.core.util.EnumUtil;import com.fasterxml.jackson.core.JsonParser;import com.fasterxml.jackson.databind.*;import com.fasterxml.jackson.databind.deser.ContextualDeserial...
byte-buddy实现mybatis-plus动态mapper
掌握了教育,就掌握了国家——法国谚语 构造动态mapper部分代码如下: 123456789101112131415public static void buildMapper(Configuration configuration, Class<?> entityClass) { if (!(configuration instanceof MybatisConfiguration)) { throw new IllegalArgumentException("configuration must be MybatisConfiguration"); } ENTITY_MAPPER_CLASS_CACHE.computeIfAbsent(entityClass, k -> { Class<?> dynamicMapper = new ByteBuddy() .makeInterface(TypeDescript...
获取某包下的类
我们总是喜欢崇敬我们的人,但并不永远喜欢我们所崇敬的人。——拉罗什富科 1234567891011121314151617181920212223242526272829303132333435363738394041424344package io.github.vampireachao.stream.core.clazz;import io.github.vampireachao.stream.core.lambda.function.SerFunc;import io.github.vampireachao.stream.core.lambda.function.SerSupp;import io.github.vampireachao.stream.core.reflect.ReflectHelper;import io.github.vampireachao.stream.core.stream.Steam;import java.io.File;import java.net.URL;import java.net.URLDecoder;import java.n...
byte-buddy
与有肝胆人共事,从无字句处读书。——周恩来 分享一个字节码框架,能在jvm运行时动态加载Class、修改Class 官方文档:https://bytebuddy.net/#/ github:https://github.com/raphw/byte-buddy.git 引入: 12345<dependency> <groupId>net.bytebuddy</groupId> <artifactId>byte-buddy</artifactId> <version>1.12.21</version></dependency> 一个简单的Hello World: 123456789Class<?> dynamicType = new ByteBuddy() .subclass(Object.class) .method(ElementMatchers.named("toString")) .intercept(FixedValue.va...
code runner
万人都要将火熄灭,我一人独将此火高高举起。——海子 分享一个插件:Code Runner可以直接运行代码,不需要复杂配置环境 安装以后可以直接运行当前文件 我们直接运行ts的话,还需要安装一个ts-node 1tyarn global add ts-node 运行代码: 12345678910111213141516171819class Student { fullName: string; constructor(firstName: string, middleInitial: string, lastName: string) { this.fullName = firstName + " " + middleInitial + " " + lastName; }}interface Person { firstName: string; lastName: string;}function greeter(person...
react新版api
我们飞得越高,我们在那些不能飞的人眼中的形象就越渺小。——尼采的《查拉图斯特拉如是说》 如果你是在react18这么写: 123456// index.tsximport React from 'react'import ReactDOM from 'react-dom'console.log('Hello from tsx!')ReactDOM.render(<p>Hello</p>, document.getElementById('root')) 你会得到一个错误 1react-dom.development.js:86 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. L...
