Skip to content

Instantly share code, notes, and snippets.

@EtienneLem
Forked from daneden/gist:8063789
Last active August 29, 2015 14:10
Show Gist options
  • Save EtienneLem/026d50ec064993526f32 to your computer and use it in GitHub Desktop.
Save EtienneLem/026d50ec064993526f32 to your computer and use it in GitHub Desktop.
# GIFme
# This is a really simple/stupid command line (specifically zsh) function to copy public Dropbox links to your gifs.
#
# Put this somewhere in your .zshrc and replace {{YOUR_PUBLIC_ID}} with your public Dropbox ID (find this by going to dropbox.com, finding a file in your "Public" folder, selecting it and clicking "Copy public link", and looking for the long number in the URL)
#
# This assumes your gifs (and other images you want to share) are stored in your Dropbox "Public" folder in a directory called "gifs".
# This whole thing ain't pretty, and it could be much better. But it's a start.
#
# Usage:
# "$ gifme yup.gif" will copy a public link to "{{Dropbox Directory}}/Public/gifs/yup.gif"
# "$ gifme nope.gif --open" will copy a public link to "{{Dropbox Directory}}/Public/gifs/nope.gif" and open that URL in your default browser
function gifme() {
if [[ -z $1 ]]; then
echo "Usage: gifme name.gif [--open]";
else
echo "https://dl.dropboxusercontent.com/u/{{YOUR_PUBLIC_ID}}/gifs/$1" | tr -d '\n' | pbcopy;
echo "Copied link to $1";
fi
if [[ -n $2 ]]; then
open https://dl.dropboxusercontent.com/u/{{YOUR_PUBLIC_ID}}/gifs/$1;
fi
}
# Autocompletion
if which gifme &> /dev/null; then
gifs_list=(`ls {{YOUR_GIFS_FOLDER_PATH}}`)
compctl -k gifs_list gifme
fi
@EtienneLem
Copy link
Author

i.e.

gifs_list=(`ls ~/Dropbox/Public/gifs`) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment