Skip to content

Instantly share code, notes, and snippets.

View jeremytenjo's full-sized avatar

Jeremy Tenjo jeremytenjo

View GitHub Profile
@jeremytenjo
jeremytenjo / ZSHScriptFromScratch.MD
Created April 14, 2021 01:28 — forked from zaimramlan/ZSHScriptFromScratch.MD
Create ZSH Script From Scratch
  1. Create new file with any name i.e. script.zsh
#!/bin/zsh
[COMMANDS_HERE]
  1. Configure permissions
$ chmod 755 script.zsh
@jeremytenjo
jeremytenjo / useKeyPress.js
Created December 30, 2020 02:29
useKeyPress React hook with multiple key support
export default function useKeyPress(keys, onPress) {
keys = keys.split(' ').map((key) => key.toLowerCase())
const isSingleKey = keys.length === 1
const pressedKeys = useRef([])
const keyIsRequested = (key) => {
key = key.toLowerCase()
return keys.includes(key)
}