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 |
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(){ | |
const w = 1920, h = 1080; | |
// Function to make elements non-responsive | |
function makeNonResponsive(element) { | |
const style = window.getComputedStyle(element); | |
const width = style.getPropertyValue('width'); | |
const height = style.getPropertyValue('height'); | |
const position = style.getPropertyValue('position'); | |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
"os/exec" | |
"os/signal" | |
"strconv" | |
"strings" |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
) |
NewerOlder