gifd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/.gifs +27 -0
  2. data/bin/gifd +38 -0
  3. metadata +48 -0
data/.gifs ADDED
@@ -0,0 +1,27 @@
1
+ surprise http://i1222.photobucket.com/albums/dd482/Frankthefish/SH%20GIFs/surprised.gif
2
+ ducktype https://p.twimg.com/AnAV9kKCEAAEptp.jpg
3
+ pingpong http://gifs.gifbin.com/072009/1247133986_ping-pong.gif
4
+ kobedunk http://i.imgur.com/o4Zw4.gif
5
+ gay-seal http://media.tumblr.com/tumblr_lq0iwbjfb91qbrrf8.png
6
+ omfgdogs http://escism.net/omfgdogs/
7
+ what-pineapple https://encrypted-tbn0.google.com/images?q=tbn:ANd9GcQt7peZnndZDdVfaFNv0nt-7JtMh14lf0ouXlycp09oSZ400q3zhrHVgQg
8
+ aliens http://i.imgur.com/UXiYV.jpg
9
+ everyone-dance i.imgur.com/aTINY.gif
10
+ chuck https://lh3.googleusercontent.com/-Mpm7Ov1fYf0/T0kXZNttPOI/AAAAAAAAVng/YYtIuqNfTKM/w350/Chuck+Norris.gif
11
+ jumbaco http://i.imgur.com/LiKTZ.gif
12
+ oh-i-get-it http://i.imgur.com/ijAzB.gif
13
+ cat-mullet http://cuteoverload.files.wordpress.com/2012/02/6914640751_8093bae306_o.jpg
14
+ colbert http://i.imgur.com/FnOSd.gif
15
+ thumbsup http://i.imgur.com/xEeza.gif
16
+ tyson http://i0.kym-cdn.com/photos/images/newsfeed/000/198/010/tysonreaction.gif
17
+ excited http://i.imgur.com/bEm1l.gif
18
+ slowclap http://images.cheezburger.com/completestore/2010/4/14/129157477066831452.gif
19
+ toast http://i.imgur.com/Es98O.gif
20
+ lakers http://i510.photobucket.com/albums/s347/mjd3221/75p4dph0cr6jihp6r24.gif
21
+ batman http://i.imgur.com/2Trsj.gif
22
+ foreveralone http://i3.kym-cdn.com/photos/images/newsfeed/000/150/505/f30fd24c56e1bcfc926883d6a51d5a00.gif
23
+ thumbsdown http://media.tumblr.com/tumblr_ltjs72LHcb1qztwte.gif
24
+ hellyeah https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcQvP16M0Oqs19A50rWsTnVLVLop9mpzzjjaLSllV0Fc91vmphXTyg
25
+ fp-dance-1 http://i40.tinypic.com/fkvd3m.gif
26
+ annie-sigh http://i.imgur.com/JRCU6.gif
27
+ sadrain http://i.imgur.com/VgXCk.gif
data/bin/gifd ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # The locations for the User's library and the Default Library
4
+ USER_GIF_LOCATION = '~/.gifs'
5
+ DEFAULT_GIF_LOCATION = File.join(File.dirname(__FILE__), '..', '.gifs')
6
+
7
+ COMMAND = ARGV[0]
8
+ DEFAULT_GIFS = Hash[`cat #{DEFAULT_GIF_LOCATION}`.split("\n").map{|g| g.split}]
9
+ USER_GIFS = Hash[`cat #{USER_GIF_LOCATION}`.split("\n").map{|g| g.split}]
10
+ GIFS = DEFAULT_GIFS.merge(USER_GIFS)
11
+
12
+ # Given a name, check if there is a gif with that name and return it.
13
+ # if not, print out suitable error messages and exit.
14
+ def gif_by_name name
15
+ gif = GIFS[name]
16
+ if gif.nil? || gif.empty?
17
+ $stderr.puts "Sorry, no gif with name #{name}"
18
+ $stderr.puts "gifs are:"
19
+ $stderr.puts GIFS.keys.map{|s| "\t#{s}"}.sort.join("\n")
20
+ exit(1)
21
+ end
22
+ gif
23
+ end
24
+
25
+ case COMMAND
26
+ when "-s"
27
+ gif_name, gif_url = ARGV[1], ARGV[2]
28
+
29
+ USER_GIFS[gif_name] = gif_url
30
+ `rm #{USER_GIF_LOCATION}`
31
+ `echo "#{USER_GIFS.to_a.reject{|k,v| v.nil?}.map{|g| g.join(' ')}.join('\n')}" > ~/.gifs`
32
+ when "-o"
33
+ gif = gif_by_name(ARGV[1])
34
+ `open #{gif}` if gif
35
+ else # Command is a gif name
36
+ gif = gif_by_name(COMMAND)
37
+ `echo #{gif} | tr -d '\n' | pbcopy` if gif
38
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gifd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Spencer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-07 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Allows users to maintain a library of gif locations, and easily copy
15
+ those to their clipboard/open them in their browser.
16
+ email: daniel.patrick.spencer@gmail.com
17
+ executables:
18
+ - gifd
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gifs
23
+ - bin/gifd
24
+ homepage: http://www.google.com
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.10
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: Manage links to gifs.
48
+ test_files: []