下面两端都能编译通过 刚才又理解了下,&str有可能引用了 slice,但编译器单从 struct 上并不能区分是 字符串常量还是 slice,所以需要显式声明周期标识 当然,如果确实是 字符串常量编译器允许你使用 'static 标识(活得永远比当前struct长)
// 自问自答下,纵使为static生命周期也必须要进行标注便于编译器进行推导
struct Person {
name: &'static str,
}下面两端都能编译通过 刚才又理解了下,&str有可能引用了 slice,但编译器单从 struct 上并不能区分是 字符串常量还是 slice,所以需要显式声明周期标识 当然,如果确实是 字符串常量编译器允许你使用 'static 标识(活得永远比当前struct长)
// 自问自答下,纵使为static生命周期也必须要进行标注便于编译器进行推导
struct Person {
name: &'static str,
}| // ==UserScript== | |
| // @name Youtube entancer of mine | |
| // @namespace http://www.chaochaogege.com | |
| // @version 0.6 | |
| // @description Some of youtube entancer of mine | |
| // @author You | |
| // @match https://www.youtube.com/watch?* | |
| // @grant none | |
| // @require https://greasyfork.org/scripts/402597-monitor-dom-change/code/monitor%20dom%20change.js?version=801281 | |
| // ==/UserScript== |
| import React, { useState } from "react"; | |
| export function useObservable(obj, isasync = false) { | |
| let asyncid = null; | |
| const [originobj, setoriginobj] = useState(obj); | |
| const handler = { | |
| get: (target, prop) => { | |
| // 递归创建并返回 | |
| if (typeof target[prop] === "object" && target[prop] !== null) { | |
| return new Proxy(target[prop], handler); | |
| } |
| 1. 将youtube的字幕设置为浮动,可以在整个网页拖拽,mutationobserve 监控DOM更改 | |
| https://gist.github.com/iamwwc/341b0513f9b22b1067a479225f3d6626 | |
| 2. mutationobserve 监控DOM更改,做成了script,用来引用,但gist由于csp限制,现在只能在油猴里面require进来 | |
| https://gist.github.com/iamwwc/680fcfe42a3e7f9fe180e1456e24cb4d | |
| 3. vscode匹配 /**/ 注释,抄作业的时候看到名字注释太多,所以用正则都去掉 | |
| https://gist.github.com/iamwwc/ecc9c8f3086d2e3c67b2cfe8c03d5746 | |
| 4. ublock origin filter rules---常用的网站屏蔽了多数广告,以及不和谐的UI | |
| https://gist.github.com/iamwwc/fad5f9f86b1dbb5aa04adb5af0638cc4 | |
| 5. 牛客ublock origin filter ---干掉牛客推荐广告 | |
| https://gist.github.com/iamwwc/f27fd88e8da872ed611b27f0fe9d268d |
| // ==UserScript== | |
| // @name Put Youtube subtitles on top of everything | |
| // @namespace http://www.chaochaogege.com | |
| // @version 0.2 | |
| // @description Use this script if you want subtitles float on entire screen! | |
| // @author You | |
| // @match https://www.youtube.com/watch?* | |
| // @grant none | |
| // @require https://greasyfork.org/scripts/402597-monitor-dom-change/code/monitor%20dom%20change.js?version=801281 | |
| // ==/UserScript== |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>org.example</groupId> | |
| <artifactId>hotelserver</artifactId> | |
| <version>1.0-SNAPSHOT</version> |
| 如下正则表达式 | |
| /\*(.|\r?\n)+?\*/ | |
| 匹配 | |
| /*hahah*/ | |
| /** | |
| 哈哈哈 |
引入
var node = document.createElement('script')
node.src = 'https://gist.githubusercontent.com/iamwwc/680fcfe42a3e7f9fe180e1456e24cb4d/raw/c2e914eee5ac70b655c98550cec8264fcc86fe05/monitor.js'
document.querySelector('body').appendChild(node)
| ! 3/23/2020 https://www.dy2018.com | |
| ||www.jianpian.vip/src/images/pc/banner_0113_pc1.jpg$image | |
| ||www.jianpian.vip/src/images/pc/banner_0110_pc1.png$image | |
| www.dy2018.com##.carousel-item | |
| ! 3/24/2020 https://www.bloomberg.com | |
| ||www.bloomberg.com/subscription-offer* | |
| ||assets.bwbx.io/s3/fence/v4/app.bundle.js | |
| www.bloomberg.com###graphics-paywall-overlay | |
| www.bloomberg.com##.bb-that |