Skip to content

Instantly share code, notes, and snippets.

Trying to do the thing with the code


Trying to do the thing with the code
View GitHub Profile
DominoPivot / mrx.js
Last active Feb 16, 2021
Parse regular expressions with comments and whitespace
View mrx.js
// Tag which parses a multiline regexp pattern into a RegExp object, removing whitespace and comments
export function mrx (strings) {
if (strings.length !== 1) {
throw Error("mrx cannot process template strings with arguments.")
// capture pattern and flags from a string in format `/pattern/flags`
const captureRx = /^\s*\/(.*)\/([a-z]*)\s*$/si;
const match = captureRx.exec(strings.raw[0]);
if (match === null) {
DominoPivot / cipher-helper.js
Last active Oct 20, 2020
Monoalphabetic Substitution Cipher Helper
View cipher-helper.js
// A tool to help you create or solve monoalphabetic substitution ciphers.
// This code is left to the public domain.
// Run this in a Node interactive session or web browser console.
// Start by creating a machine instance with m = machine(message);
// Call m.repeat() to progressively replace each letter with a new one.
// Use lowercase for your original message and uppercase for the
// substituted letters so you and the code can tell them apart.
// m.frequency will give you the fequency of each letter in the message.
DominoPivot / minimal-html5-template.html
Last active Oct 23, 2020
Minimalist HTML5 page template
View minimal-html5-template.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Template Site</title>
<a href="/">Template Site</a>
DominoPivot /
Last active Nov 4, 2018
spymao - 0h Game Jam 2018 entry
import random
deck = None
hand = None
def speak(message="", penalty=""):
maxlen = max(len(message), len(penalty))
# pad both parts even