$ gem install code_snippet
$ snippet -h
A simple CLI tool for accessing code snippets
Capture good practice once by building templates of your code projects straight in your file system, and render them interactively from the command line.
Snippets are just files, you can save them and organize them any way you want.
Snippets can be filtered by language (file extension) and results are displayed in an interactive list.
The show command takes finds the snippet you want quickly and the `--copy=true` flag copies it straight into your clipboard - in 1 command.
No charge, and it won't stalk you around the internet either. It's also open source and hackable.