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
| /** | |
| * Fetches npm packages for a user, filters by Tidelift presence | |
| * and download count (>10k), then returns (count * 50). | |
| * @param {string} username - The npm username or organization name. | |
| */ | |
| async function getTideliftValuation(username) { | |
| try { | |
| // 1. Fetch packages by maintainer | |
| const searchUrl = `https://registry.npmjs.org/-/v1/search?text=maintainer:${username}&size=250`; | |
| const searchRes = await fetch(searchUrl); |
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
| async function getFullContributionData(username) { | |
| let repoStats = new Map(); // Stores repoPath => prCount | |
| let page = 1; | |
| let keepGoing = true; | |
| console.log(`🚀 Gathering full intelligence on ${username}'s contributions...`); | |
| while (keepGoing) { | |
| const url = `https://api.github.com/search/issues?q=is:pr+is:merged+author:${username}&per_page=100&page=${page}`; | |
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 { spawn } from 'node:child_process'; | |
| import { platform } from 'node:process'; | |
| const isWin = platform() === 'win32'; | |
| const isMac = platform() === 'darwin'; | |
| export async function writeClipboard(text: string): Promise<void> { | |
| return new Promise((resolve, reject) => { | |
| let proc; | |
| if (isMac) { |
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
| (3+4)^3=343 | |
| (3*1+2)^5=3125 |
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
| type Params = Record<string, string | number | boolean | null | undefined>; | |
| const buildUrl = (path: string, params?: Params): URL => { | |
| const API_URL = "https://neal.fun/api/infinite-craft"; | |
| const url = new URL(`${API_URL}${path}`); | |
| if (params) { | |
| for (const [key, value] of Object.entries(params)) { | |
| if (value !== null && value !== undefined) { | |
| url.searchParams.append(key, String(value)); |
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
| type TypeToString<T> = T extends | |
| | string | |
| | number | |
| | bigint | |
| | boolean | |
| | null | |
| | undefined | |
| ? T | |
| : T extends symbol | |
| ? "symbol" |
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
Show hidden characters
| { | |
| "compilerOptions": { | |
| "declaration": true, | |
| "target": "esnext", | |
| "module": "esnext", | |
| "moduleResolution": "bundler", | |
| "moduleDetection": "force", | |
| "rootDir": "./", |
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> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Directed Graph Editor</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.24.0/cytoscape.min.js"></script> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; |
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 pyautogui as pg | |
| def circle(x: int, y: int, radius: int): | |
| pg.mouseDown(x + radius, y) | |
| positions: list[tuple[int, int]] = [ | |
| ((radius**2 / 2) ** (1 / 2), (radius**2 / 2) ** (1 / 2)), | |
| (0, radius), | |
| (-((radius**2 / 2) ** (1 / 2)), (radius**2 / 2) ** (1 / 2)), |
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
| class Cube: | |
| def __init__(self, x_size: int, y_size: int, z_size: int, /): | |
| self.x_size = x_size # Width | |
| self.y_size = y_size # Height | |
| self.z_size = z_size # Depth | |
| self.front = __ = [["🟥"] * x_size for _ in range(y_size)] # Front | |
| self.back = ___ = [["🟧"] * x_size for _ in range(y_size)] # Back | |
| self.top = ____ = [["🟩"] * x_size for _ in range(z_size)] # Top | |
| self.bottom = _ = [["🟦"] * x_size for _ in range(z_size)] # Bottom |
NewerOlder