Skip to content

Instantly share code, notes, and snippets.

View tmikeschu's full-sized avatar

Mike Schutte tmikeschu

View GitHub Profile
@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;
}
// 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;
const az = {
a: (![] + [])[+!![]],
d: ([][[]] + [])[+!![] + !![]],
e: (![] + [])[+!![] + !![] + !![] + !![]],
f: (![] + [])[+[]],
i: ([][[]] + [])[+!![] + !![] + !![] + !![] + !![]],
l: (![] + [])[+!![] + !![]],
n: ([][[]] + [])[+!![]],
r: (!![] + [])[+!![]],
s: (![] + [])[+!![] + !![] + !![]],
@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);
# page 2
=begin
Station>>computePart: aPart
^self multiplyPartTimesRate: aPart
Station>>multiplyPartTimesRate: aPart
^Part
amount: aPart amount * self rate
date: aPart date
=end
@tmikeschu
tmikeschu / translate_polygon_points.rb
Created June 23, 2019 22:20
A fun little script I made to translate svgs polygon points from sketch to my inline implementations
#!/usr/bin/env ruby
def pbcopy(s)
IO.popen("pbcopy", "w") { |f| f << s }
end
def translate(x_offset, y_offset, raw_xys)
raw_xys
.strip
.split("\n")

4.0.4 Do Now

  1. Log in to REPL

  2. Look at the following code:

# my_building is a representation of the apartments on each floor of my 3 story building
my_building = [
 ['apt1a', 'apt1b', 'apt1c'], 

4.0.3 Do Now

  1. Log in to Repl
  2. Write down what the output of the function print_6_stars is:
def print_6_stars(): 
    my_string = ''
    for i in range(0, 6): 
 my_string += ' *'

5/9/19 Do Now

  1. Start computers and get logged in to REPL

  2. In your Oregon Trail app:

  • How much health does a player have?

  • How many pounds of food does a player have?

@tmikeschu
tmikeschu / dtr.md
Last active November 9, 2018 02:59

Blocks DTR

Goals

Seamus

  • Improve on FP paradigms
    • explore flexibility and dynamism
  • Build something together (w/ Mike)

Mike