Skip to content

Instantly share code, notes, and snippets.

View tmikeschu's full-sized avatar

Mike Schutte tmikeschu

View GitHub Profile
# page 2
=begin
Station>>computePart: aPart
^self multiplyPartTimesRate: aPart
Station>>multiplyPartTimesRate: aPart
^Part
amount: aPart amount * self rate
date: aPart date
=end
@tmikeschu
tmikeschu / useTypewriter.js
Last active June 29, 2019 21:58
A simple typewriter effect using hooks and emotion
import { css, cx } from 'emotion';
import React, { useEffect, useState } from 'react';
export default function useTypewriter(
text,
{ speed = 40, Component = 'p', startingIndex = -30 } = {},
) {
// start negative to create a delayed effect to offset the initial transition of the slide
const [charIndex, setCharIndex] = useState(startingIndex);
const az = {
a: (![] + [])[+!![]],
d: ([][[]] + [])[+!![] + !![]],
e: (![] + [])[+!![] + !![] + !![] + !![]],
f: (![] + [])[+[]],
i: ([][[]] + [])[+!![] + !![] + !![] + !![] + !![]],
l: (![] + [])[+!![] + !![]],
n: ([][[]] + [])[+!![]],
r: (!![] + [])[+!![]],
s: (![] + [])[+!![] + !![] + !![]],
// goal is to be able to extend the notification payload type depending on the server implementation
// library
interface PushNotification {
// ...
}
interface PushNotificationOptions<T> {
// ...
onNotification?: (notification: PushNotification & T) => void;
@tmikeschu
tmikeschu / machine.js
Created November 24, 2019 19:22
Generated by XState Viz: https://xstate.js.org/viz
function createUUID() {
var dt = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
});
return uuid;
}
@tmikeschu
tmikeschu / machine.js
Last active December 22, 2019 04:57
Generated by XState Viz: https://xstate.js.org/viz
const BOOK_OR_REVIEW = { BOOK: '#schedule', DATES: '#dates' };
const routesMachine = Machine(
{
id: 'routes',
initial: 'codeOfConduct',
context: {
lastScreen: '',
},
states: {
@tmikeschu
tmikeschu / machine.js
Created December 23, 2019 01:07
Generated by XState Viz: https://xstate.js.org/viz
const BOOK_OR_REVIEW = { BOOK: '#schedule', DATES: '#dates' };
const appMachine = Machine(
{
id: 'app',
initial: 'codeOfConduct',
context: {
lastScreen: 'schedule',
selectedAttendee: undefined,
},
states: {
@tmikeschu
tmikeschu / machine.js
Created December 29, 2019 17:31
Generated by XState Viz: https://xstate.js.org/viz
const machineConfig = {
initial: "idle",
id: "main",
context: {
initialTime: 0,
currentTime: 0,
notificationTimes: []
},
states: {
idle: {
@tmikeschu
tmikeschu / machine.js
Created February 4, 2020 22:09
Generated by XState Viz: https://xstate.js.org/viz
const BOOK_OR_REVIEW = { BOOK: '#schedule', DATES: '#dates' };
const machine = Machine({
id: 'app',
initial: 'fetchAttendee',
context: {
lastScreen: 'schedule',
friendId: undefined,
friendTimeId: undefined,
someoneNewTimes: new Set(),
@tmikeschu
tmikeschu / machine.js
Created March 26, 2020 21:04
Generated by XState Viz: https://xstate.js.org/viz
const DATES_TAB = {
target: "dates",
actions: ["sendGAEvent"],
}
Machine({
id: "app",
initial: "fetchAttendee",
context: {
lastScreen: "schedule",
friendId: undefined,