Skip to content

Instantly share code, notes, and snippets.

Avatar

Sarah Dayan sarahdayan

View GitHub Profile
View machine.js
const editor = Machine({
type: 'parallel',
states: {
sidebar: {
initial: 'expanded',
states: {
expanded: {
on: {
TOGGLE_SIDEBAR: 'collapsed',
},
View useHotkeys.ts
import hotkeys, { HotkeysEvent } from 'hotkeys-js';
import { useEffect, useCallback } from 'preact/hooks';
/**
* A Preact hook for triggering side-effects when pressing hotkeys.
*
* @param keys A comma-separated list of hotkeys to trigger the callback on.
* @param callback A callback function to execute when keys are pressed.
* @param dependencies A list of dependencies.
*/
View machine.js
const toggleMachine = Machine({
id: "toggle",
initial: "visible",
states: {
visible: {
on: {
TOGGLE: "hidden"
},
initial: "rendered",
states: {
@sarahdayan
sarahdayan / modifiers.scss
Last active Nov 11, 2021
Sass Modifiers Mixin
View modifiers.scss
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// Sass modifiers mixin by Sarah Dayan
// Generate All Your Utility Classes with Sass Maps: frontstuff.io/generate-all-your-utility-classes-with-sass-maps
// http://frontstuff.io
// https://github.com/sarahdayan