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 / what-i-want.md
Last active November 19, 2020 00:15
What I want from a global state manager
  • Manage shared state
  • Allow for subscriptions from React
  • Allow for mutation from React
  • Allow for subscriptions from non-React
  • Allow for mutation from non-React
  • Allow for methods on the global state
  • Allow for derived data on the global state
  • Optimized re-renders
import * as NanoTimer from "nanotimer";
import { get } from "lodash";
const foo = {
bar: {
baz: 1,
},
};
const iterateWithOptionalChaining = () => {
@jherr
jherr / home-page.html
Created December 29, 2020 16:20
Growler Home Page
<div class="mx-auto max-w-screen-xl">
<div style="grid-template-columns: 1fr 2fr 3fr;" class="grid gap-4 m-4">
<img
src="http://valleygrowlers.com/wp-content/uploads/2013/11/clean_line_circle_logo-300x300.jpg"
/>
<div
class="text-2xl"
>
Come join us every day starting at noon… Valley Growlers would love to have you as a guest. Come have a pint or take a growler or crowler to go....
</div>
const inject = (str, obj) => str.replace(/\${(.*?)}/g, (_, g) => obj[g]);
console.log(
inject("Hello ${name}, Bye ${name2}", { name: "Jack", name2: "Dave" })
);
@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
#include <iostream>
#include <list>
using namespace std;
int getValue(int index) {
int guessValue = 0;
/*
while (guessValue < 1 || guessValue > 100) {
cout << "Guess #" << index + 1 << ": ";
#include <random>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int rollDice(int top) {
return (rand() % top) + 1;
@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";
import { atom, WritableAtom } from "jotai";
import firebase from "firebase";
function atomWithCollection<TData>(
collection: firebase.firestore.CollectionReference
): WritableAtom<
TData[],
{
id: string;
data: TData;
#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;