Skip to content

Instantly share code, notes, and snippets.

@lewdev
Created January 20, 2023 02:32
Show Gist options
  • Select an option

  • Save lewdev/b1ff920aee592bef58b878f3e81deef8 to your computer and use it in GitHub Desktop.

Select an option

Save lewdev/b1ff920aee592bef58b878f3e81deef8 to your computer and use it in GitHub Desktop.
πŸ˜† Generate an excuse to cancel plans
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="container my-4">
<h1>❌ Canceling Plans Excuse Generator</h1>
<div class="card card-body p-4 m-4">
<div id="o"></div>
</div>
<div class="text-center my-3">
<button class="btn btn-primary btn-lg" onclick="render()">βš™ Generate</button>
</div>
<details>
<summary>View Options</summary>
<div class="card card-body my-2">
<div id="d"></div>
</div>
</details>
</div>
<script>
onload = () => {
render();
d.innerHTML = `<table class="table">
<thead><tr>${["Intro", "Scapegoat", "Delay"].map(a => `<th>${a}</th>`).join``}</tr></thead>
<tbody>${new Array(allOptions.reduce((p, c) => Math.max(p, c.length), 0)).fill().map((_, i) => `<tr>${allOptions.map(b => `<td>${b[i] || "-"}</td>`).join``}</tr>`).join``}</tbody>
</table>`;
};
const intros = `Sorry I can't come
Please forgive my absence
This is going to sound crazy but
Get this:
I can't go because
I know you're going to hate me but
I was minding my own business and boom!
I feel terrible but
I regretfully cannot attend,
This is going to sound like an excuse but`.split`\n`;
// CHOOSE A SCAPEGOAT
const scapeGoats = `my nephew
the ghost of Hitler
the Pope
my ex
a high school marching band
Dan Rather
a sad clown
the kid from Air Bud
a professional cricket team
my Tinder date`.split`\n`;
// CHOOSE A DELAY
const delays = `just shit the bed
died in front of me
won't stop telling me knock knock jokes
is having a nervous breakdown
gave me syphilis
poured lemonade in my gas tank
stabbed me
found my box of human teeth
stole my bicycle
posted my nudes on Instagram`.split`\n`;
const getRandInArr = arr => arr[~~(Math.random() * arr.length)];
const allOptions = [intros, scapeGoats, delays];
const render = () => o.innerHTML = allOptions.map(getRandInArr).join` ` + ".";
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment