Skip to content

Instantly share code, notes, and snippets.

View wallergoble's full-sized avatar

Waller Goble wallergoble

View GitHub Profile
@wallergoble
wallergoble / index.tsx
Created March 22, 2023 18:28
Recursive tokenizing react component
import React from 'react';
const Color = ({ color }) => <span style={{ color }}>{color}</span>;
const RecursiveText = ({ text }) => {
const words = text.split(' ');
const renderWord = (index) => {
if (index >= words.length) return null;
const word = words[index];
if (['red', 'blue', 'green'].includes(word)) {
@wallergoble
wallergoble / templateLiterals.ts
Created July 26, 2022 16:50
Typescript template literals
/**
* String template literal types
*/
type FlagColor = "red" | "green" | "yellow";
type LightFlagColor = `light${FlagColor}`;
let lightRed: LightFlagColor = "lightred";
@wallergoble
wallergoble / conditionals.ts
Created May 17, 2022 16:56
Typescript Conditionals
import { options } from './lib'
/**
* Conditional Types in typescript are a subtype of generic types
*
* They are useful for deriving information from the type system
*/
// Generics aka Parametric Types: Types which take types and return other types
namespace FrontendCoeRules {
@wallergoble
wallergoble / prompt.md
Last active April 21, 2021 00:26
Scheduling Problem

Given a list of N names, print out a schedule where each person meets with every other person in the list exactly once.

Bonus: Given a set amount of time in minutes, evenly distribute the time amongst each meeting round.


e.g.

names: ['Alex', 'Kate', 'Kyle', 'Liz']

@wallergoble
wallergoble / builder.ts
Created March 15, 2021 15:57
Mockydoodle
import { Primitive } from 'type-fest';
type Resolver<T> = (...args: any) => T;
type AnyFunc = (...args: any[]) => any;
type ArrayType<T> = T extends Array<infer U> ? U : never;
export type Schema<T> = {
[P in keyof T]: P extends Primitive
@wallergoble
wallergoble / cloudSettings
Last active September 10, 2019 19:26
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-09-10T19:26:06.069Z","extensionVersion":"v3.4.2"}
@wallergoble
wallergoble / continuousintegration.md
Last active March 12, 2017 22:11
Gist about CI tooling and Travis CI

Continuous Integration Tooling

What is CI? CI stands for Continuous Integration, which is continously deploying code to a shared repo several times a day. Each time it is checked in, it is verified by an automated build.

Advantages

  • Enables automated testing