Skip to content

Instantly share code, notes, and snippets.

@wandernauta
Created December 10, 2011 19:47
Show Gist options
  • Save wandernauta/1456089 to your computer and use it in GitHub Desktop.
Save wandernauta/1456089 to your computer and use it in GitHub Desktop.
Read cheat sheets from cheat.errtheblog.com without Ruby.
#
# cheat.sh
# Read cheat sheets from cheat.errtheblog.com without Ruby.
#
# Put (or source) this in your .zsh_profile or whatever.
#
# Usage:
# $ cheat sheets
# $ cheat recent
# $ cheat zsh
# $ cheat vim --edit
#
# Bugs:
# - Doesn't cache. At all.
# - Doesn't try to parse YAML.
#
cheat () {
ROOT="http://cheat.errtheblog.com"
if [[ $1 = "recent" ]]; then
curl -s "$ROOT/yr/" | tail -n +2;
elif [[ $2 = "--edit" ]]; then
curl -s "$ROOT/y/$1/" | $EDITOR -;
else
curl -s "$ROOT/y/$1/" | tail -n +3 | sed 's/^ //' | $PAGER;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment