- Prime Number: Integer > 1 with exactly two factors (1 and itself)
- Prime Factorization: Expressing a number as product of primes
-
Primality Test (naive): Check if any number from 2 to
$\sqrt{n}$ divides n
function isPrime(n) {
/** RGB color in functional notation (e.g. rgb(255, 0, 0)) */ | |
export type RGB = `rgb(${number}, ${number}, ${number})`; | |
/** RGBA color in functional notation (e.g. rgba(255, 0, 0, 0.5)) */ | |
export type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`; | |
/** HSL color in functional notation (e.g. hsl(0, 100%, 50%)) */ | |
export type HSL = `hsl(${number}, ${number}%, ${number}%)`; | |
/** HSLA color in functional notation (e.g. hsla(0, 100%, 50%, 0.5)) */ |
Important
This is an executable Markdown file, an experiment of merging documentation and code together. A tool for running the code is under development. The focus of this document is to figure a syntax that does not get in the way of the code.
Original version from elijahmanor's gist
#!/bin/zsh | |
########################################################### | |
# Get URLs for the current branch or the main branch | |
# Adding a path after the command will show the URL of that file on the current branch and the main branch | |
# | |
# NOTE: this DOES NOT CHECK if the file exists on github | |
#---------------------------------------------------------- | |
# Examples: | |
# ```bash |
#!/usr/bin/env nu | |
# Tail the last 50 lines of docker-compose logs and follow | |
cat log.txt | lines | |
| each { sed 's/^[^|]*| //' } | |
| where { |line| $line =~ "^\{" } | |
| each { from json } | |
| each { |record| | |
let t = $record.t."$date" | |
let s = $record.s |
#!/usr/bin/env nu | |
# Tail the last 50 lines of docker-compose logs and follow | |
cat log.txt | lines | |
| each { sed 's/^[^|]*| //' } | |
| where { |line| $line =~ "^\{" } | |
| each { from json } | |
| each { |record| | |
let t = $record.t."$date" | |
let s = $record.s |
name: WriteFile version: 1.0.0 description: A plugin to write content to a file original_url: https://example.com/plugin/writeFile.md endpoints:
import { expandToChalkString } from './template-strings.ts'; | |
const exit = (error: string, code: number = -1) => { | |
console.info(eval(`expandToChalkString\`${error}\``)); | |
process.exit(code); | |
} | |
import type { ForegroundColorName } from 'chalk'; | |
const info = (msg: string, color: ForegroundColorName = 'yellow') => { |
.DS_Store | |
# Logs | |
logs | |
*.log | |
npm-debug.log* | |
yarn-debug.log* | |
yarn-error.log* | |
lerna-debug.log* | |
.pnpm-debug.log* |
/** | |
* Represents a Marko tag name enclosed in angle brackets. | |
* Used to define custom Marko tags within a taglib definition. | |
*/ | |
type TagShorthand = `<${string}>`; | |
/** | |
* Represents a shorthand for defining repeated tag within a Marko tag. | |
*/ | |
type RepeatedTag = `${TagShorthand}[]`; |