这个是油猴脚本。安装了暴力猴插件之后,点击上面这个文件的 Raw 按钮,会提示安装。
- pdf.js 可以提取所有的 TextItem 包括文本和包围盒
- 根据包围盒可以大致判断一下是否换行了
- 如果一行中包含了公式,那么一行会有很多个 TextItem,这些行会称之为 complex 的行
- 多个连续的 complex 行变成了 complex 块
- 如果有 claude 3 haiku 的账号会对 complex 块做一次基于图片的 OCR 来清洗嘈杂的带公式的文本
javascript:(function(){ | |
const getComputedStyleString = (element) => { | |
const computed = window.getComputedStyle(element); | |
let styles = ''; | |
for (const prop of computed) { | |
if (prop.includes('"')) { | |
continue; | |
} | |
const value = computed.getPropertyValue(prop); |
const YOUR_CLAUDE_KEY = '' | |
async function main() { | |
const resp = await fetch('https://api.anthropic.com/v1/messages', { | |
method: 'POST', | |
headers: { | |
"x-api-key": YOUR_CLAUDE_KEY, | |
"anthropic-version": '2023-06-01', | |
"content-type": "application/json", | |
}, | |
body: JSON.stringify({ |
// ==UserScript== | |
// @name 拷贝任意选中的 HTML | |
// @description 方便粘贴到 chatgpt 进行问答 | |
// @namespace github.com/taowen | |
// @match *://*/* | |
// @version 1.0.0 | |
// @author taowen | |
// @license MIT | |
// @grant GM.registerMenuCommand | |
// @grant GM_setClipboard |
// ==UserScript== | |
// @name youtube转文本到剪贴板 | |
// @description 方便粘贴到 chatgpt 进行问答 | |
// @namespace github.com/taowen | |
// @match https://www.youtube.com/* | |
// @version 1.0.0 | |
// @author taowen | |
// @license MIT | |
// @grant GM.registerMenuCommand | |
// @grant GM_setClipboard |
// ==UserScript== | |
// @name arxiv论文转markdown拷贝到剪贴板 | |
// @description 方便粘贴到 chatgpt 进行问答 | |
// @namespace github.com/taowen | |
// @match https://ar5iv.labs.arxiv.org/* | |
// @match https://browse.arxiv.org/html/* | |
// @match https://arxiv.org/html/* | |
// @version 1.0.1 | |
// @author taowen | |
// @license MIT |
Layout projection: A method for animating browser layouts at 60fps
Animating layout is hard. Prohibitively so; how many ambitious designers have provided dev teams dazzling videos of app-quality UI animations, only to be rebuffed?
If you're a web developer, what would your reaction be if asked to realise this kind of App Store-style interaction, where an item opens into a full-screen view when clicked:
@sources.Scene | |
export class AccountDemo extends RootSectionModel { | |
@constraint.required | |
public name: string; | |
@constraint.required | |
public password: string; | |
private justFailed: boolean; |
CREATE TABLE `Account` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) NOT NULL UNIQUE, | |
`password` varchar(255) NOT NULL, | |
`status` varchar(255) NOT NULL, | |
`retryCount` int(11) NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; |
const MAX_RETRY_COUNT = 3; | |
@sources.Mysql() | |
export class Account extends Process { | |
public name: string; | |
// plain text, just a demo | |
public password: string; | |
public retryCount: number; |