This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Two files (the helper function and its associated tests) have been | |
// concatenated here for the sake of fitting into one Gist. | |
// File: flatten-array.ts | |
// ---------------------- | |
// Type definitions | |
type Nested<T> = Array<T | Nested<T>> | |
// Flattens an array by recursively iterating through items of the | |
// (nested) array, returning the values at the leaf nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map ; openCommandBar | |
" Page navigation | |
map <C-f> scrollFullPageDown | |
map <C-b> scrollFullPageUp | |
map <C-d> scrollPageDown | |
map <C-u> scrollPageUp | |
map <C-e> scrollDown | |
map <C-y> scrollUp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command prompt | |
export PS1='[\u@\h \W]\$ ' | |
# Color LS | |
alias ls='ls -hFG' | |
# Color GREP | |
alias grep='grep --color=auto' | |
# Tab completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set completion-ignore-case on | |
set show-all-if-ambiguous on | |
# tab: menu-complete | |
# Use Unicode & do NOT use the "8bit hack" to input/output non-ASCII characters | |
# See http://code.google.com/p/iterm2/wiki/Keybindings | |
set input-meta on | |
set output-meta on | |
set convert-meta off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SIZE_MB=${1:-1024} | |
SECTORS=$((${SIZE_MB}*1024*1024/512)) | |
diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://${SECTORS}` |