Skip to content

Instantly share code, notes, and snippets.

@tijnjh
tijnjh / ref.svelte.ts
Created August 15, 2025 21:45
svelte ref
export interface Ref<T> {
get current(): T
set current(value: T)
}
export function ref<T>(value: T): Ref<T> {
let state = $state<T>(value)
return {
get current() {
// itpipe.js
/**
* Creates a proxy that captures method calls for piping
* @returns {Proxy} The 'it' proxy object
*/
const createItProxy = () => {
return new Proxy({}, {
get: (target, prop) => {
if (typeof prop === 'symbol' || prop === 'inspect') {
return () => {};
function selectListing(name) {
return document.querySelector(`h3[data-tag="${name}"]`);
}
const items = document.querySelectorAll(".opblock-tag-section > h3 > a > span");
let paths = [];
for (const { textContent } of items) {
paths.push(textContent);
}