This file contains 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 * as fs from "fs"; | |
import * as path from "path"; | |
import typescript from "typescript"; | |
import { sync as globSync } from "glob"; | |
interface LinterConfig { | |
allow: string[]; | |
disallow: string[]; | |
} |
This file contains 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
const modelsData = Array.from(document.querySelectorAll('table.table-fixed tbody tr')).map(row => { | |
const modelLinkElement = row.querySelector('a.block.text-slate-11.underline'); | |
const modelName = modelLinkElement ? modelLinkElement.textContent.trim() : ''; | |
const modelHref = modelLinkElement ? modelLinkElement.getAttribute('href') : ''; | |
const modelCode = row.querySelector('code.text-xs') ? row.querySelector('code.text-xs').textContent.trim() : ''; | |
// Get price cells | |
const priceTds = row.querySelectorAll('td.text-center'); | |
// Process prices: extract numeric value, convert to number * 100 |
This file contains 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 monitorAllNetworkTraffic(callback = null) { | |
// Store original methods | |
const originalFetch = window.fetch; | |
const originalXHROpen = XMLHttpRequest.prototype.open; | |
const originalXHRSend = XMLHttpRequest.prototype.send; | |
const originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; | |
// Collection of all messages in order | |
const messageLog = []; | |
This file contains 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
const sharp = require("sharp"); | |
const fs = require("fs/promises"); | |
const sizes = [16, 48, 128]; | |
async function convertIcons() { | |
try { | |
await fs.mkdir("dist/assets", { recursive: true }); | |
for (const size of sizes) { |
This file contains 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
// Paste this in your browser's console | |
async function testOpenRouter() { | |
const API_KEY = 'YOUR_API_KEY_HERE'; // Replace with your actual API key | |
try { | |
const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { | |
method: 'POST', | |
headers: { | |
'Authorization': `Bearer ${API_KEY}`, | |
'Content-Type': 'application/json', |
This file contains 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 rx(x, y, env) { | |
function isNumber(str) { | |
if (typeof str !== "string") return false; // Must be a string | |
if (str.trim() === "") return false; // Empty string isn't a number | |
return !isNaN(str) && isFinite(Number(str)); | |
} | |
x = l(x) | |
.v.map((t) => String.fromCharCode(t.v)) | |
.join(""); | |
y = l(y) |
This file contains 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 to close any open code blocks | |
function closeCodeBlocks() { | |
const closeButtons = document.querySelectorAll('button'); | |
closeButtons.forEach((button) => { | |
const svgPath = button.querySelector('svg > path'); | |
if (svgPath && svgPath.getAttribute('d').includes('M205.66')) { | |
// This path corresponds to the close icon (adjust if necessary) | |
button.click(); | |
} | |
}); |
This file contains 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 { useState, useEffect } from 'react'; | |
const subscribers = new Map<string, Set<React.Dispatch<any>>>(); | |
function useLocalStorage<T>(key: string, initialValue: T) { | |
// State to store our value | |
const [storedValue, setStoredValue] = useState<T>(() => { | |
try { | |
const item = window.localStorage.getItem(key); | |
return item ? (JSON.parse(item) as T) : initialValue; |
This file contains 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
class ReactiveLocalStorage { | |
constructor() { | |
this.listeners = {}; | |
} | |
setItem(key, value) { | |
localStorage.setItem(key, value); | |
this.notify(key, value); | |
} |
This file contains 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
#!/bin/bash | |
find . -name "package.json" -type f | while read -r file; do | |
# Backup the original file | |
cp "$file" "${file}.bak" | |
# Process dependencies and devDependencies | |
for key in dependencies devDependencies; do | |
jq --arg key "$key" ' | |
if has($key) then |
NewerOlder