This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // biu, a bundler for htmls with typescript, run with bun | |
| // bun build ./biu.ts --compile --outfile=biu | |
| // usage: biu [src-dir] [out-dir] [--watch] | |
| // use ?? to force import ts/js inline, e.g. import {my} from "my.ts??"; | |
| import { build, type Plugin } from "bun"; | |
| import { minify as minifyHtml } from "html-minifier-terser"; | |
| import CleanCSS from "clean-css"; | |
| // updated from https://github.com/lit/lit/tree/main/packages/labs/rollup-plugin-minify-html-literals/src/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 录10秒视频 | |
| tell application "Photo Booth" to activate | |
| delay 1 | |
| tell application "System Events" to tell process "Photo Booth" | |
| click radio button 3 of radio group 1 of group 1 of window "Photo Booth" | |
| end tell | |
| tell application "System Events" | |
| set frontmost of process "Photo Booth" to true | |
| keystroke return using {option down} -- option + enter | |
| end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 拍照片 | |
| tell application "Photo Booth" to activate | |
| delay 1 | |
| tell application "System Events" | |
| -- click radio button 2 of radio group 1 of group 1 of window 1 | |
| set frontmost of process "Photo Booth" to true | |
| keystroke return using {option down} -- option + enter | |
| end tell | |
| tell application "Photo Booth" to quit |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // restore animation timepoint from first animation of an element | |
| export function restore(anis, key) { | |
| if (anis.length === 0) return; | |
| const s = sessionStorage.getItem(key); | |
| if (!s) return; | |
| const t = s.split(",").map((v) => parseFloat(v)); | |
| Array.from(anis).some((ani, i) => { | |
| ani.pause(); | |
| ani.startTime = t[0] || 0; | |
| ani.currentTime = t[1] || 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(raw, key) { | |
| const d = raw.split('\n').map(line => line.trim()).filter(line => !!line); | |
| console.log(key, d.length); | |
| if (d.length == 0) return; | |
| const tab = document.querySelector('.dmc-mysql-operating-filter .tea-table__body table.tea-table__box'); | |
| const nb = tab.querySelector('tr:last-child > td > div > div'); | |
| let n = d.length - [].slice.apply(tab.querySelectorAll('tr')).length + 1; | |
| while (n > 0) { nb.click();n--;} | |
| const trs = [].slice.apply(tab.querySelectorAll('tr')).slice(0, d.length); | |
| trs.forEach((tr,i) => [].slice.apply(tr.querySelectorAll('div.tea-segment > button')).forEach(btn => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Make a QCompleter to match all keywords seperated by space | |
| // MyCompleter is a customize splitPath QCompleter | |
| class MyCompleter : public QCompleter { | |
| public: | |
| MyCompleter(QAbstractItemModel* model, QObject* parent = nullptr) | |
| : QCompleter(model, parent) | |
| { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Schedule daily tasks at moment or every dur from at to another time point of the day | |
| // schedule.go | |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "strings" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Make a HTML dom or element with id or id-header (if exists, only header) draggable | |
| // auto init .draggable elements, <div class="draggable">Drag Here</div><script src="draggable.js"></script> | |
| // usage: draggable(elm) | |
| // orgin from https://gist.github.com/mindon/84a8906a2d9e7ad078ae07692b52c460 | |
| globalThis.draggable = ((auto = true, stylize = true, globalized = false) => { | |
| // ---------->>> | |
| const win = globalThis || window; | |
| console.assert(win); | |
| const doc = win.document; | |
| console.assert(doc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // generate points inside a geometry, with THREE.js | |
| // Mindon<[email protected]> https://mindon.dev, 2024.08.01 | |
| // Example code: | |
| // const inside = Inside(THREE); | |
| // const material = new THREE.PointsMaterial({color: 0xffffff, size: 0.25}); | |
| // scene.add(inside.points(num, geometry, material)); | |
| // // scene.add(new THREE.Points(inside.geometry(num, geometry), material)); | |
| export function Inside(THREE) { | |
| const ray = new THREE.Ray(); |
NewerOlder