π΅βπ«
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 fs from 'fs'; | |
import { fileURLToPath } from 'url'; | |
import path from 'path'; | |
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads'; | |
const __filename: string = fileURLToPath(import.meta.url); | |
const __dirname: string = path.dirname(__filename); | |
const filePath = path.join(__dirname, 'server', 'data', 'nsfw-names.txt'); | |
const fileContent = fs.readFileSync(filePath, 'utf8'); |
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 { fileURLToPath } from "node:url" | |
import { readFileSync, writeFileSync } from "node:fs" | |
import { dirname } from "node:path" | |
(() => { | |
const __dirname = dirname(fileURLToPath(import.meta.url)) | |
console.log(`${__dirname}<path><file_name>.<extension>`) | |
const robots = readFileSync(`${__dirname}<path><file_name>.<extension>`, "utf-8") | |
const kv: Map<string, string> = new Map<string, string>() |
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 os | |
import re | |
import sys | |
from typing import List | |
class FileSystem: | |
def __init__(self, path='.') -> None: | |
self.path = path | |
def filter_files(self, files, pattern) -> List[str]: |
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 { readFileSync } from 'fs'; | |
import { join } from 'path'; | |
import { z } from 'zod'; | |
const packages = readFileSync(join(__dirname, 'package.json'), 'utf8'); | |
const schema = z.object({ | |
devDependencies: z.record(z.string()), | |
dependencies: z.record(z.string()), | |
}); |
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 { readFileSync, writeFileSync, readdirSync } from "node:fs"; | |
import { join } from "path"; | |
const paste: string = ` | |
<key>=<value> | |
... | |
` | |
const envFiles: string[] = readdirSync(process.cwd()).filter((file) => file.startsWith(".env")); |
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 { Button } from '@/components/ui/button'; | |
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
/// <reference lib="dom" /> | |
import React from 'react'; | |
import { FaMicrophone } from 'react-icons/fa'; | |
import { useIsomorphicLayoutEffect } from 'usehooks-ts'; | |
/* | |
* Intakes a state setter where the component | |
* will store the result of speech to text into |
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 { useQueryState } from 'nuqs'; | |
import { useCallback } from 'react'; | |
import { useIsomorphicLayoutEffect } from 'usehooks-ts'; | |
import { v4 as uuidv4 } from 'uuid'; | |
export const usePersistedId = ( | |
key: string, | |
): { | |
id: string | null; | |
clearId: () => void; |
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 { readFileSync, writeFileSync } from "node:fs"; | |
import { join } from "node:path"; | |
const packageJsonPath: string = join(process.cwd(), "package.json"); | |
const packageJson: { dependencies: Record<string, string>, devDependencies: Record<string, string> } = JSON.parse(readFileSync(packageJsonPath, "utf8")); | |
const dependencies: Map<string, string> = new Map(Object.entries(packageJson.dependencies)); | |
const devDependencies: Map<string, string> = new Map(Object.entries(packageJson.devDependencies)); | |
const dependencies_: Record<string, string> = Object.fromEntries(dependencies); |
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
#!/bin/bash | |
# Exit immediately if a command exits with a non-zero status. | |
set -e | |
# Treat unset variables as an error. | |
set -u | |
# --- Colors --- | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' |
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 { readFileSync, writeFileSync } from "node:fs"; | |
import { join } from "node:path"; | |
interface PackageJson { | |
dependencies: Record<string, string>; | |
devDependencies: Record<string, string>; | |
[key: string]: any; | |
} | |
function mergePackageJsons(current: PackageJson, toMerge: PackageJson): PackageJson { |