Skip to content

Instantly share code, notes, and snippets.

View jcreamer898's full-sized avatar
🏠
Working from home

Jonathan Creamer jcreamer898

🏠
Working from home
View GitHub Profile

Below is one way to break down the calculation. In Lorcana you roll with a 60‐card deck that contains 4 copies of “Belle” and 4 copies of “Pawpsicle.” At the start you draw 7 cards. Then—using your one mulligan opportunity—you may keep any “key” (i.e. Belle or Pawpsicle) cards you already have and put all the rest on the bottom of your deck, drawing new cards until you again have 7 cards in hand. (In other words, if you’re missing one or both of your key cards, you discard every “non‐key” card and draw that many replacements from the remainder of the deck.) Under the assumption that you follow this optimal strategy, we can split the outcomes into four cases.

Step 1. Find the chance you see each key in the initial 7 without mulligan.

Let’s define the events:
• A = “at least one Belle is in your 7‐card hand”
• B = “at least one Pawpsicle is in your 7‐card hand”

Because there are 4 copies of a given key in a 60‑card deck, the chance to see no copy of (say) Belle in a 7‑card draw is

Subscaler

An opinionated suite of patterns, tools, and practices to help sublinearly scale your engineering systems.

Sublinearly scaling a repository requires thinking differently. There's often no "one size fits all" solution to how to scale. Instead there's a set of principles, and ideas that all culminate in an ecosystem and a culture of thinking which lends itself to easily growing without the confines of some overarching, and limitng tool.

Principles

Do one thing, and one thing well.

@jcreamer898
jcreamer898 / getMonorepoRoot.js
Created May 16, 2023 20:03
A simple way to get the path to the root package.json in a monorepo.
const getRootPackageJsonRecursively = async () => {
let currentDir = __dirname;
let packageJson;
let nextDir = "";
while (currentDir) {
try {
packageJson = await fs.readFile(
path.join(currentDir, "package.json"),
"utf8"
import path from "path";
import findRoot from "find-root";
import chalk from "chalk";
import type { Compiler, Plugin, compilation } from "webpack";
interface PluginOptions {
verbose?: boolean;
showHelp?: boolean;
emitError?: boolean;
exclude?: string[] | undefined | null;
@jcreamer898
jcreamer898 / adr.md
Created November 10, 2022 18:24
Templates for RFCs and ADRs used at Microsoft in the 1JS Engineering System.

TITLE

Date: YYYY-MM-DD

Status

PROPOSED | ACCEPTED | DEPRECATED

Context

set-option -g mouse on
setw -g mode-keys vi
set -g history-limit 20000
#bind P paste-buffer
#bind-key -T copy-mode-vi v send-keys -X begin-selection
#bind-key -T copy-mode-vi y send-keys -X rectangle-toggle
#unbind -T copy-mode-vi Enter
#bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
@jcreamer898
jcreamer898 / get-toc.js
Created January 12, 2022 22:10
Creates a JSON structure to generate a toc.yml file
const fs = require("fs");
const path = require("fs");
/**
*
* @param {string} item
*/
const cleanName = (item) => {
return item.replace(/\s/g, "-");
};

Type 'from' in the editor and...

What even is TypeScript?

JavaScript + Types = Typescript

TypeScript as a compilter

npm i -g typescript

./node_modules/.bin/tsc

#!/bin/sh
set -e
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in