Skip to content

Instantly share code, notes, and snippets.

View tikotzky's full-sized avatar

Mordy Tikotzky tikotzky

  • QualityBath.com
View GitHub Profile
import { useState, useEffect } from 'react';
// Usage
function App() {
// Call our hook for each key that we'd like to monitor
const happyPress = useKeyPress('h');
const sadPress = useKeyPress('s');
const robotPress = useKeyPress('r');
const foxPress = useKeyPress('f');
@tikotzky
tikotzky / machine.js
Created November 13, 2019 16:26
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
function fetchJSON(options, cb) {
const wrappedCb = (...args) => setTimeout(() => cb(...args), 0);
fetch(options).
then(res => res.json()).
then(json => wrappedCb(null, json), err => wrappedCb(err))
}
### Keybase proof
I hereby claim:
* I am tikotzky on github.
* I am tikotzky (https://keybase.io/tikotzky) on keybase.
* I have a public key whose fingerprint is A046 6A89 6994 850A 05CC 9A27 4D0F A8B7 DF2C A035
To claim this, I am signing this object: