Skip to content

Instantly share code, notes, and snippets.


Brian Boyko brianboyko

View GitHub Profile
View threeIntegers.js
const solve = (inputs /* a sorted list of integers */) => {
let count = 0;
let f = 0;
let l = inputs.length -1;
let m = f + 1;
const sum = () => inputs[f] + inputs[l] + inputs[m];
while(sum() !== 2020){
count += 1
if(sum() > 2020){
l -= 1;
brianboyko / StateMachine.ts
Created Nov 5, 2020
A version of a state machine implementation in Typescript
View StateMachine.ts
class StateMachine {
private currentKey: string = ""
private stateCache: Record<string, any> = {}
private actionCache: Record<string, Record<string, string>> = {};
constructor(initialKey: string, initialState?: any) {
this.currentKey = initialKey;
if (initialState) {
this.defineState(initialKey, initialState);
brianboyko / .eslintrc.js
Created Oct 6, 2020
Current Build Process - looking for advice
View .eslintrc.js
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
allowImportExportEverywhere: false
env: {
brianboyko /
Created Oct 3, 2020
On the Morality of Shadenfreude

Some thoughts on Trump having COVID.

We have no way of knowing whether or not Trump really has COVID.

One of the frustrating things about the news is that while Donald Trump and the White House says Trump has COVID, we cannot believe them on their words alone. This administration has lied about everything from day one (including the President's health) and we have long learned not to take anything they have said at face value.

Because of four years of lies, misdirection, and long cons, we just don't have any reason at all to believe it - and the only evidence we have either way is coming from the White House. All we can say for sure is that the White House is claiming that Donald Trump has COVID, and that isn't worth a damn thing.

One can think of many reasons that Donald Trump might be faking the disease if he doesn't have it: to downplay how deadly it is by a "miraculous recovery" right before the election, to get out of the October 15th debates. Already the Biden campaign has pulled negativ

brianboyko / new-reducer.ts
Created Sep 21, 2020
You can save a heck of a lot of boilerplate by switching to Redux Toolkit
View new-reducer.ts
import Api from "../../ajax/api";
import {createSlice} from '@reduxjs/toolkit';
import get from 'lodash/get';
export interface IPhotosState {
query: string;
totalHits: number;
hits: any[];
total: number;
View pepper2020.txt
extended from /u/irepostoldmemes on imgur, and with apologies to the Butthole Surfers.
Mark infected Sharon.
Sharon got Sharice.
They were sharin' Sharon's Covids
'Cause it's such a quick disease.
Mikey has Pneumonia scars,
Bobby got shot by the racists,
brianboyko / Match.spec.ts
Created Jul 11, 2020
A Simple Match Class.
View Match.spec.ts
import Match from "./Match";
const simpleMatch = new Match(
["reverse", (input: string) => input.split("").reverse().join("")],
["scream", (input: string) => input.toUpperCase()],
(input: string) => `default output: ${input}`
brianboyko / Movie.cpp
Last active Jun 20, 2020
Am I creating a memory leak here?
View Movie.cpp
#include "Movie.h"
#include <iostream>
#include <string>
Movie::Movie(string name, string rating, int init_watched) : name{name}, rating{rating}, watched{init_watched} {
std::cout << "Creating: " << name << " " << rating << "\n";
Movie::Movie() : Movie{"UNNAMED MOVIE", "UNNAMED RATING", 0} {};

The Supermarket Notes

Here are some notes Brian Boyko is using to swot up for the interview with a supermarket client, but I'm saving it to Github Gist so that maybe others can use it. This is mostly stuff I already knew, but it's been a while since I had to get back-to-basics and remember these as concepts, so I did a bit of swotting up, and took these notes.

The Event Loop

Javascript has a call stack; like any LIFO stack, it only pushes and pops; when a function is called, it pushes onto the stack, when the function is returned, it pops that function off of the stack. This is how the program "keeps track" of where it is; when you see an error message, you'll almost always see a printout of the current call stack.

Javascript was designed as a single-threaded language; it does one thing at a time. This makes it great for simplicity but when you have "slow" functions, like a database call or a network request (which may never resolve), then the entire execution will wait for your slow functions. The b

brianboyko / eslintrc.yml
Created Mar 18, 2020
eslint isn't working
View eslintrc.yml
- 'prettier'
- 'prettier/react'
- 'plugin:react/recommended'
- 'plugin:import/errors'
- 'plugin:import/warnings'
- 'plugin:jsx-a11y/recommended'
- 'plugin:@typescript-eslint/recommended'
- 'prettier/@typescript-eslint'
overrides: [{ files: ['*.js', '*.jsx'], rules: { '@typescript-eslint/*': "off" } }]
You can’t perform that action at this time.