Gif is a Ruby Gem that plays gifs in your terminal. First, it fetches a gif using Giphy's API. The response from the API includes a link to an S3 bucket that I fetch with cURL (stored in a temporary directory). This gif is then unoptimized to include only 256 colors (the most colors that iTerm supports) and resized to fill the Terminal window height and width.
Next, I split up the gif into individual frames using gifsicle, a neat gif manipulation tool. I decided on using gifsicle and not ImageMagick because even though many ImageMagick is more popular, it requires a special version (with X11) to manipulate gifs. Asking users to uninstall a package they already have and then reinstall a special version of said package seemed a bit much. Thus, gifsicle.
Finally, I display each frame in the Terminal using imgcat, a tool that is "like cat, but for images". It displays images in the Terminal by converting JPEGS into matrices of colored spaces. In iTerm, I don't need to use imgcat, and just display gifs natively.
You can check out the GitHub repository for it here.