Skip to content

Instantly share code, notes, and snippets.

View jherr's full-sized avatar
💭
Making a bunch of videos for the coming weeks

Jack Herrington jherr

💭
Making a bunch of videos for the coming weeks
View GitHub Profile
@jherr
jherr / index.ts
Last active July 5, 2021 14:43
Decorator starting point
const delay = <T>(time: number, data: T): Promise<T> =>
new Promise((resolve) =>
setTimeout(() => {
resolve(data);
}, time)
);
class Users {
async getUsers() {
return await delay(1000, []);
@jherr
jherr / advanced-event-handler.ts
Created May 17, 2021 14:29
Code for No BT TS - Challenge 3
class EventProcessor {
handleEvent(eventName: ..., data: ...): void {
}
addHandler(handler: ...) {
}
getProcessedEvents(): ...[] {
}
}
@jherr
jherr / houses.json
Created April 17, 2021 20:57
Challenge #1
[
{ "name": "Atreides", "planets": "Calladan" },
{ "name": "Corrino", "planets": ["Kaitan", "Salusa Secundus"] },
{ "name": "Harkonnen", "planets": ["Giedi Prime", "Arrakis"] }
]
#include <iostream>
#include <fstream>
using namespace std;
// Generic print function that takes an output stream.
// Can be used to print to the screen by passing cout.
// Can be used to print to a file by passing a file stream.
void printSomething(ostream &out, string somethingToSay) {
out << "Something cool:" << somethingToSay << endl;
import { atom, WritableAtom } from "jotai";
import firebase from "firebase";
function atomWithCollection<TData>(
collection: firebase.firestore.CollectionReference
): WritableAtom<
TData[],
{
id: string;
data: TData;
@jherr
jherr / App.js
Last active February 8, 2021 13:16
ScandiPWA First Demo script and resources
import { Component } from "react";
import {
ChakraProvider,
Heading,
Box,
Text,
Grid,
Image,
} from "@chakra-ui/react";
#include <random>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int rollDice(int top) {
return (rand() % top) + 1;
#include <iostream>
#include <list>
using namespace std;
int getValue(int index) {
int guessValue = 0;
/*
while (guessValue < 1 || guessValue > 100) {
cout << "Guess #" << index + 1 << ": ";
@jherr
jherr / mario.cc
Created January 10, 2021 19:00
CS101 | C++ | Mario game
/*
Make a simple text game that has:
[X] Has a design using a flowchart
[X] Uses deeply nested conditionals
[X] Handles edge cases
[X] Uses variables with a variety of the basic data types (string, bool, int, long, float, double)
[X] Uses random
[X] Uses a mathematical operator
[X] No gotos or globals
const inject = (str, obj) => str.replace(/\${(.*?)}/g, (_, g) => obj[g]);
console.log(
inject("Hello ${name}, Bye ${name2}", { name: "Jack", name2: "Dave" })
);