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
| function encode(str) { | |
| return ( | |
| encodeURIComponent(str) | |
| .replace( | |
| /[\-\_\.\!\~\*\'\(\)]/g, | |
| (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, | |
| ) | |
| ); | |
| } |
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
| function hi() { | |
| console.log("hi") | |
| } |
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
| function actions_per_turn(speeds, turns) { | |
| const arr = []; | |
| const slowest_speed = Math.min(...speeds); | |
| for (const speed of speeds) { | |
| const speed_arr = []; | |
| let remainder = 0; | |
| for (let i = 0; i < turns; i++) { | |
| const value = speed / slowest_speed + remainder; | |
| const floored = Math.floor(value); | |
| speed_arr.push(floored); |
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
| const damage = 100; | |
| const hp = 15_000; | |
| const damage_reduction = .25; | |
| const damage_reduction_limit = hp * .3; | |
| const damage_reduced = Math.min(damage * damage_reduction, damage_reduction_limit); | |
| const incoming_damage = Math.max(1, damage - damage_reduced); |
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
| export interface Field { | |
| contentType?: string; | |
| filename?: string; | |
| name: string; | |
| value: string | Uint8Array; | |
| } | |
| export const boundary = Math.random().toString(16).substring(2); | |
| export async function* fileIterator(fields: Field[]) { |
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 { randomBytes } from "node:crypto"; | |
| import { request as httpRequest } from "node:http"; | |
| import { request as httpsRequest } from "node:https"; | |
| const DEFAULT_PORT = 443; | |
| const SEC_WEBSOCKET_VERSION = 13; | |
| class WebSocket extends EventTarget { | |
| constructor(url, protocols) { | |
| super(); |
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
| const APPDATA = Deno.env.get("APPDATA"); | |
| const index = await Deno.readTextFile( | |
| `${APPDATA}/.minecraft/assets/indexes/1.19.json`, | |
| ); | |
| const json = JSON.parse(index); | |
| const directories = {}; | |
| const promises1 = []; |
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
| const APPDATA = Deno.env.get("APPDATA"); | |
| const VERSION = 2; | |
| while (true) { | |
| const input = prompt("Search for a mod:"); | |
| if (input === null) { | |
| continue; | |
| } | |
| console.log("Searching..."); |
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
| echo "# gerdjt" >> README.md | |
| git init | |
| git add README.md | |
| git commit -m "first commit" | |
| git branch -M master | |
| git remote add origin https://github.com/apacheli/gerdjt.git | |
| git push -u origin master |
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 aiohttp | |
| import asyncio | |
| import os | |
| async def main(): | |
| async with aiohttp.ClientSession() as session: | |
| headers = { | |
| "accept": "application/vnd.github.v3+json" | |
| } | |
| async with session.request("GET", "https://api.github.com/emojis", headers=headers) as response: |
NewerOlder