Skip to content

Instantly share code, notes, and snippets.

@kylemh
kylemh / .zshrc
Last active January 11, 2019 07:03
Just as a back-up
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# NPM Token
# export NPM_TOKEN="some-key"
# Path to your oh-my-zsh installation.
export ZSH=/Users/kyleholmberg/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
@kylemh
kylemh / env.sh
Last active August 1, 2017 19:30
#!/usr/bin/env bash
AUTOENV_AUTH_FILE=~/.autoenv_authorized
if [[ -n "${ZSH_VERSION}" ]]
then __array_offset=0
else __array_offset=1
fi
autoenv_init()
{
" Show line numbers
set number
" Blink cursor on error instead of beeping (grr)
set visualbell
" Turn on syntax highlighting
syntax on
" Color scheme (terminal)
@kylemh
kylemh / solarized.vim
Created January 11, 2019 07:06
syntax highlighting for vim (.vim/colors/solarized.vim)
" Name: Solarized vim colorscheme
" Author: Ethan Schoonover <[email protected]>
" URL: http://ethanschoonover.com/solarized
" (see this url for latest release & screenshots)
" License: OSI approved MIT license (see end of this file)
" Created: In the middle of the night
" Modified: 2011 May 05
"
" Usage "{{{
"
function getLongWordsFromString(text) {
const lowerCased = text.toLocaleLowerCase().trim();
const words = lowerCased.split(/\s+|\W+/); // split on any whitespace and non-word character
const longWords = words.filter(word => word.length > 5);
return longWords.length > 0 ? longWords.join(', ') : '';
}
@kylemh
kylemh / useModal.tsx
Created April 2, 2024 16:55
This a pretty helpful thing to setup and expand upon for applications with loads of modals... It's helpful to hoist dialogs, snackbars, and toasts to a coalesced layer for upkeep and style uniformity (like animation timing).
import { createContext, useContext, useReducer, useMemo } from 'react';
import type { ComponentProps, FunctionComponent, PropsWithChildren, Reducer, Dispatch } from 'react';
import { AnimatePresence } from 'framer-motion';
type ModalProps<T = {}> = T & PropsWithChildren<{ closeModal: () => void }>;
type ModalComponentType = FunctionComponent<ModalProps>;
interface ModalState {
Modal: FunctionComponent<ModalProps>;
props?: {