Skip to content

Instantly share code, notes, and snippets.

View metaory's full-sized avatar

.̶r̶̶ꝋꝋ̶̶̶𐌕 metaory

View GitHub Profile
@metaory
metaory / mini-animal-chance.js
Created September 16, 2024 07:01
mini chance.js
const animals = {
//list of ocean animals comes from https://owlcation.com/stem/list-of-ocean-animals
ocean: ['Acantharea', 'Anemone', 'Angelfish King', 'Ahi Tuna', 'Albacore', 'American Oyster', 'Anchovy', 'Armored Snail', 'Arctic Char', 'Atlantic Bluefin Tuna', 'Atlantic Cod', 'Atlantic Goliath Grouper', 'Atlantic Trumpetfish', 'Atlantic Wolffish', 'Baleen Whale', 'Banded Butterflyfish', 'Banded Coral Shrimp', 'Banded Sea Krait', 'Barnacle', 'Barndoor Skate', 'Barracuda', 'Basking Shark', 'Bass', 'Beluga Whale', 'Bluebanded Goby', 'Bluehead Wrasse', 'Bluefish', 'Bluestreak Cleaner-Wrasse', 'Blue Marlin', 'Blue Shark', 'Blue Spiny Lobster', 'Blue Tang', 'Blue Whale', 'Broadclub Cuttlefish', 'Bull Shark', 'Chambered Nautilus', 'Chilean Basket Star', 'Chilean Jack Mackerel', 'Chinook Salmon', 'Christmas Tree Worm', 'Clam', 'Clown Anemonefish', 'Clown Triggerfish', 'Cod', 'Coelacanth', 'Cockscomb Cup Coral', 'Common Fangtooth', 'Conch', 'Cookiecutter Shark', 'Copepod', 'Coral', 'Corydoras', 'Cownose Ray', '
@metaory
metaory / 2024_34-35.md
Last active August 29, 2024 16:25
2024 Public Journal

Week 34-35 -- Aug 2024

TL;DR

1. markup.json

DOM tree representation in compact JSON -- Draft Spec, Library and CLI

Note

Publicly published under MIT License Available on GitHub and NPM

@metaory
metaory / basic-jsonc-sed.md
Last active August 11, 2024 16:29
Basic JSONC SED Parser

Basic JSONC Parser

Note

it removes

  • Comments to end of line
  • Single line block comments
  • Empty lines

Caution

its NOT covering

@metaory
metaory / README.md
Last active July 24, 2024 21:38
Helix alias ── PAGER / MANPAGER

Helixpager

Alias POC

  • :set-language markdoc on init
@metaory
metaory / query-search-param.md
Last active June 12, 2024 23:01
Pure Web API URL Query Strings
@metaory
metaory / weak-cache.js
Last active January 9, 2024 08:42
WeakMap Cache
const { log } = console;
const TTL_MN = 5 // mintes
const TTL_MS = TTL_MN * 60 * 1_000 // milliseconds
const MapRefs = new Map();
const Maps = new WeakMap();
function fetchStuff(someId) {
const ref = MapRefs.get(someId);
const map = Maps.get(ref);
const expired = Date.now() - (map?.ts ?? 0) > TTL_MS
@metaory
metaory / replace-wildcard-with-non-repeating.js
Last active June 10, 2022 14:53
replace wildcard with non-repeating characters
/*
Rick is a fan of logic-based games. However, he is bored of the classic ones, like Sudoku and Mastermind, since he has solved so many of them. Recently he found a new game in which one is given a string with some question marks in it. The objective is to replace all of the question marks with letters (one letter per question mark) in such a way that no letter appears next to another letter of the same kind.
Write a function:
function solution(riddle);
that, given a string riddle, returns a copy of the string with all of the question marks replaced by lowercase letters (a−z) in such a way that the same letters do not occur next to each other. The result can be any of the possible answers as long as it fulfils the above requirements.
Examples:
@metaory
metaory / install-redis.sh
Created November 30, 2015 13:01 — forked from four43/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/four43/e00d01ca084c5972f229/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@metaory
metaory / gist:56e3f92781860a45db8c
Created November 16, 2015 14:01 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch