Skip to content

Instantly share code, notes, and snippets.

View drewwyatt's full-sized avatar

Drew Wyatt drewwyatt

View GitHub Profile
@drewwyatt
drewwyatt / native-event-button.tsx
Last active May 19, 2019 04:02
onClick={wat} snippet
import React, { DetailedHTMLProps, FC, HTMLAttributes } from 'react';
import { useNativeEvent } from './useNativeEvent';
type ButtonProps = DetailedHTMLProps<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
type Props =
& ButtonProps
& { onClick: EventListener }; // make onClick required
export const NativeEventButton: FC<Props> = ({ onClick, ...rest }) => {
const ref = useNativeEvent('click', onClick)
@drewwyatt
drewwyatt / machine.js
Created October 21, 2020 02:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@drewwyatt
drewwyatt / create_or_checkout.yml
Created October 26, 2023 22:17
Create a new branch only if one doesn't already exist
name: Create or Update Branch
on:
workflow_dispatch:
inputs:
branch:
required: true
jobs:
checkout-branch:
runs-on: ubuntu-latest