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
let s = "let s = %s;\nconsole.log(s, JSON.stringify(s));"; | |
console.log(s, JSON.stringify(s)); |
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 required modules for handling user input, streams, and Bluesky API | |
import { createInterface } from 'node:readline'; | |
import { Writable } from 'node:stream'; | |
import { BskyAgent } from '@atproto/api'; | |
// Create a readline interface to get user input from the terminal | |
const rl = createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); |
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
<body><style> | |
html, body, canvas { | |
padding: 0; | |
margin: 0; | |
overflow: hidden; | |
background-color: black; | |
width: 100vw; | |
height: 100vh; | |
} | |
pre { |
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 Byte = i8; | |
type Word = i16; | |
const SIZE: Byte = 8; | |
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd)] | |
pub struct Percent(Byte); | |
impl Percent { | |
pub const MAX: Percent = Percent(Byte::MAX); | |
pub const MID: Percent = Percent(Byte::MAX / 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
use std::fmt; | |
use std::error::Error; | |
type Buffer = Vec<u8>; | |
pub trait ReadU24BE { | |
fn read_u24_be(&self, pos: usize) -> Result<u32, OutOfRangeError>; | |
} | |
impl ReadU24BE for Buffer { |
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 letters = 'abcdefghijklmnopqrstuvwxyz' | |
function randomString(max, min = 1) { | |
let length = Math.floor(Math.random()*(max+2-min)+min); | |
let word = ''; | |
while (word.length < length) { | |
word += letters[Math.floor(Math.random()*letters.length)]; | |
} | |
return word; | |
} |
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 default function randomBigInt(max) { | |
const segment = Number.MAX_SAFE_INTEGER; | |
const bigSegment = BigInt(segment); | |
const maxArray = []; | |
for (let bigMax = BigInt(max), zero = 0n; bigMax > zero; bigMax /= bigSegment) { | |
maxArray.unshift(Number(bigMax % bigSegment)); | |
} | |
const superSum = (a, b) => a * bigSegment + b; | |
return function() { | |
let unlimited = false; |
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 { getOptions } from 'loader-utils'; | |
import CSS from 'css'; | |
import XRegExp from 'xregexp'; | |
export default function cssPrefixLoader(content) { | |
const { prefix, ...options } = getOptions(this); | |
let ast = CSS.parse(content); |
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 { getOptions } from 'loader-utils'; | |
import XRegExp from 'xregexp'; | |
import toSource from 'tosource'; | |
export default function ejsLoader(content) { | |
let options = getOptions(this); | |
let [source, ...imports] = compileEjs(content, options); | |
return ( |
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
/* | |
This script reads the nearby global.d.ts file and exports a list of imports as | |
an object. Imports need to follow the same structure as the example below. This | |
script only works with default exports but could be modified to use named | |
exports instead. | |
Example: | |
`global.d.ts` |
NewerOlder