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
<textarea id="code" rows="15" cols="80">import {useState} from 'react' | |
import {Button} from '@mui/material' | |
export default function App() { | |
const [count, setCount] = useState(0) | |
return <> | |
<Button variant="outlined" onClick={() => setCount(c => c + 1)}> | |
Count: {count} | |
</Button> |
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
// ==UserScript== | |
// @name GitHub Shorten Commit URL | |
// @namespace short-commit.github.com | |
// @match https://github.com/**/commit/* | |
// @grant none | |
// @version 1.0 | |
// @author hyrious | |
// @description Replace shorter URL if abbrev commit hash exist | |
// ==/UserScript== | |
void function() { |
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
<!DOCTYPE html> | |
<title>Stroke Test</title> | |
<style> | |
* { box-sizing: border-box; } | |
body { margin: 0; } | |
.container { | |
position: absolute; | |
inset: 50px 100px; | |
border: 1px solid; |
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
import sublime | |
import sublime_plugin | |
import json | |
from collections import OrderedDict | |
# https://github.com/antfu/eslint-config/blob/main/src/configs/sort.ts | |
KeyOrder = [ | |
'publisher', | |
'name', | |
'displayName', |
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
// This file persists Loro doc to indexeddb | |
import type { Loro, LoroEvent } from 'loro-crdt' | |
import { Remitter, ReadonlyRemitter } from 'remitter' | |
import * as idb from 'lib0/indexeddb' | |
export interface PersistEventData { | |
synced: IPersistProvider | |
} | |
export interface IPersistProvider { |
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
$("dup", async () => { | |
if (fs.existsSync("pnpm-lock.yaml")) { | |
const { packages } = yaml.load(fs.readFileSync("pnpm-lock.yaml", "utf8")); | |
let last = ["", ""]; | |
let seen = new Set(); | |
const log = (s) => seen.has(s) || (seen.add(s), console.log(s)); | |
for (const path in packages) { | |
const i = path.lastIndexOf("@"); | |
const pkg = path.slice(1, i); | |
const ver = path.slice(i + 1); |
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
// ==UserScript== | |
// @name GitHub PDF Raw Link | |
// @namespace raw-pdf.github.hyrious.me | |
// @match https://github.com/* | |
// @grant none | |
// @version 1.0 | |
// @author hyrious | |
// @description Replace PDF file's link with its raw link | |
// @require https://cdn.jsdelivr.net/npm/[email protected]/selector-set.js | |
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js |
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
// gcc -shared -Os -s -o a.dll -m32 mouse-wheel.c | |
#define WIN32_LEAN_AND_MEAN | |
#include <Windows.h> | |
HHOOK hook; | |
DWORD delta; | |
LRESULT CALLBACK LowLevelMouseProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam) { | |
if (wParam == WM_MOUSEWHEEL) { | |
MSLLHOOKSTRUCT *mouse = (MSLLHOOKSTRUCT *)lParam; |
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
<script id="worker" src="data:,"> | |
// the empty "src" prevents code inside this block from being executed! | |
// this is the source code of the worker. | |
postMessage("Hello world!") | |
</script> | |
<script> | |
var blob = new Blob([document.getElementById('worker').textContent], |
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
-Wall -Wextra -pedantic -Wimplicit-fallthrough -Wsequence-point -Wswitch-default -Wswitch-unreachable -Wswitch-enum -Wstringop-truncation -Wbool-compare -Wtautological-compare -Wfloat-equal -Wshadow=global -Wpointer-arith -Wpointer-compare -Wcast-align -Wcast-qual -Wconversion -Wwrite-strings -Wdangling-else -Wlogical-op |