Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Benjamin Cooper bencooper222

👋
View GitHub Profile
View swipe.js
const swipes = [];
require('readline')
.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
})
.on('line', line => {
console.log('\007'); // beep beep
View keybase.md

Keybase proof

I hereby claim:

  • I am bencooper222 on github.
  • I am benc222 (https://keybase.io/benc222) on keybase.
  • I have a public key whose fingerprint is 8BB5 3BD1 4C1C DF2F EAEE 4928 B9BD 15E1 CCA2 B985

To claim this, I am signing this object:

@bencooper222
bencooper222 / getter.js
Created Jul 12, 2019
This pulls comic starting from a user-defined day and getting a user-defined number of days after that. See early comments for licensing information.
View getter.js
// MIT License Copyright (c) 2019 Benjamin Cooper
// I take no responsibility for your use of this code.
// you'll have to install these modules with npm/yarn
const download = require('image-downloader');
const fetch = require('node-fetch');
const cheerio = require('cheerio');
Date.prototype.addDays = function(days) {
var date = new Date(this.valueOf());
@bencooper222
bencooper222 / inequality.json
Created Feb 7, 2020
Global income distribution by region with deciles.
View inequality.json
[
{
"region": "eu & oecd",
"decile1": 8388929.281,
"decile2": 7038948.781,
"decile3": 11950912.07,
"decile4": 19841097.99,
"decile5": 33950521.39,
"decile6": 58059009.92,
"decile7": 94884323.46,
@bencooper222
bencooper222 / ilTax.js
Created Oct 11, 2020
Calculate tax burden of IL joint filers in JS under the Fair Tax Amendment
View ilTax.js
// gonna refer to this as bracket0, bracket1 etc
//| Income | Marginal Tax Rate |
//|------------------------|-------------------|
//| $0 – $10,000 | 4.75% |
//| $10,001 – $100,000 | 4.90% |
//| $100,001 – $250,000 | 4.95% |
//| $250,001 – $500,000 | 7.75% |
//| $500,001 – $1,000,000 | 7.85% |
//| $1,000,001 and above | 7.95% on net |
@bencooper222
bencooper222 / graph.txt
Last active Jan 27, 2021
Runs thousands of trials to evaluate whether putting the seat down or up or not changing it is best
View graph.txt
https://shared.benc.io/screencaps/2018/09/Oropendula/24704094-46c0-4af6-afdb-56f7747625bc.png
That graph shows the default code's (seen above) results. Lower on the graph means better. This graph indicates that the best approach is to leave the seat where you had it except in the niche case where there is less than 2% biological males using that toilet. My guess is that would only apply to biological males who have undergone a gender change and now use the women's restroom.
@bencooper222
bencooper222 / expect-errors.mjs
Created Nov 5, 2021
Reads a set of ts compiler errors and inserts ts-expect-error before all of them (has known off by one flaws)
View expect-errors.mjs
import { readFileSync, writeFileSync } from 'fs';
const errors = readFileSync('./out.txt', 'utf-8')
.split('\n')
.filter(el => !el.startsWith(' '));
const parsedErrors = [];
for (const err of errors) {