meme_captain 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/ChangeLog +4 -0
  2. data/README.md +0 -45
  3. data/lib/meme_captain.rb +0 -6
  4. data/lib/meme_captain/caption.rb +6 -4
  5. data/lib/meme_captain/caption_choice.rb +3 -1
  6. data/lib/meme_captain/image_list.rb +0 -5
  7. data/lib/meme_captain/text_pos.rb +8 -6
  8. data/lib/meme_captain/version.rb +1 -1
  9. data/meme_captain.gemspec +5 -18
  10. metadata +2 -181
  11. data/config.ru +0 -50
  12. data/doc/lightweight_front_end.md +0 -64
  13. data/doc/setup.md +0 -13
  14. data/lib/meme_captain/image_list/cache.rb +0 -49
  15. data/lib/meme_captain/image_list/fetch.rb +0 -28
  16. data/lib/meme_captain/image_list/fetch_error.rb +0 -17
  17. data/lib/meme_captain/image_list/source_image.rb +0 -30
  18. data/lib/meme_captain/meme_data.rb +0 -33
  19. data/lib/meme_captain/norm_params.rb +0 -92
  20. data/lib/meme_captain/pretty_format.rb +0 -12
  21. data/lib/meme_captain/server.rb +0 -303
  22. data/lib/meme_captain/source_fetch_fail.rb +0 -28
  23. data/lib/meme_captain/upload.rb +0 -30
  24. data/public/css/screen.css +0 -80
  25. data/public/favicon.ico +0 -0
  26. data/public/js/fabric.min.js +0 -4
  27. data/public/js/jquery-1.7.2.min.js +0 -4
  28. data/public/js/meme_captain.js +0 -391
  29. data/public/source_images.json +0 -234
  30. data/public/thumbs.jpg +0 -0
  31. data/public/thumbs_1330486916.jpg +0 -0
  32. data/public/thumbs_1333591668.jpg +0 -0
  33. data/public/thumbs_1334189407.jpg +0 -0
  34. data/public/thumbs_1334973608.jpg +0 -0
  35. data/public/thumbs_1336623277.jpg +0 -0
  36. data/public/thumbs_1336624196.jpg +0 -0
  37. data/public/thumbs_1339811279.jpg +0 -0
  38. data/public/tmp/.gitignore +0 -0
  39. data/script/thumb_sprites.rb +0 -76
  40. data/spec/image_list/fetch_spec.rb +0 -33
  41. data/spec/norm_params_spec.rb +0 -223
  42. data/spec/pretty_format_spec.rb +0 -9
  43. data/views/404.erb +0 -17
  44. data/views/index.erb +0 -130
  45. data/watermark.png +0 -0
@@ -1,234 +0,0 @@
1
- {
2
- "thumbHeight": 50,
3
- "thumbSpritesUrl": "http://memecaptain.com/thumbs_1339811279.jpg",
4
- "images": [
5
- {
6
- "url": "http://memecaptain.com/aliens.jpg",
7
- "thumbWidth": 57
8
- },
9
- {
10
- "url": "http://memecaptain.com/all_the_things.jpg",
11
- "thumbWidth": 67
12
- },
13
- {
14
- "url": "http://memecaptain.com/all_the_things2.jpg",
15
- "thumbWidth": 67
16
- },
17
- {
18
- "url": "http://memecaptain.com/annoying_facebook_girl.jpg",
19
- "thumbWidth": 50
20
- },
21
- {
22
- "url": "http://memecaptain.com/aw_yeah.png",
23
- "thumbWidth": 50
24
- },
25
- {
26
- "url": "http://memecaptain.com/bad_joke_eel.jpg",
27
- "thumbWidth": 67
28
- },
29
- {
30
- "url": "http://memecaptain.com/bad_luck_brian.jpg",
31
- "thumbWidth": 42
32
- },
33
- {
34
- "url": "http://memecaptain.com/bad_time.jpg",
35
- "thumbWidth": 60
36
- },
37
- {
38
- "url": "http://memecaptain.com/bear_grylls.jpg",
39
- "thumbWidth": 45
40
- },
41
- {
42
- "url": "http://memecaptain.com/boromir.jpg",
43
- "thumbWidth": 85
44
- },
45
- {
46
- "url": "http://memecaptain.com/business_cat.jpg",
47
- "thumbWidth": 50
48
- },
49
- {
50
- "url": "http://memecaptain.com/conspiracy_keanu.jpg",
51
- "thumbWidth": 50
52
- },
53
- {
54
- "url": "http://memecaptain.com/cool_story_bro.jpg",
55
- "thumbWidth": 72
56
- },
57
- {
58
- "url": "http://memecaptain.com/courage_wolf.jpg",
59
- "thumbWidth": 50
60
- },
61
- {
62
- "url": "http://memecaptain.com/dwight_schrute.jpg",
63
- "thumbWidth": 73
64
- },
65
- {
66
- "url": "http://memecaptain.com/first_day_on_the_internet_kid.jpg",
67
- "thumbWidth": 38
68
- },
69
- {
70
- "url": "http://memecaptain.com/first_world_problems.jpg",
71
- "thumbWidth": 72
72
- },
73
- {
74
- "url": "http://memecaptain.com/fry.png",
75
- "thumbWidth": 67
76
- },
77
- {
78
- "url": "http://memecaptain.com/good_guy_greg.jpg",
79
- "thumbWidth": 51
80
- },
81
- {
82
- "url": "http://memecaptain.com/grandma.jpg",
83
- "thumbWidth": 68
84
- },
85
- {
86
- "url": "http://memecaptain.com/insanity_wolf.jpg",
87
- "thumbWidth": 50
88
- },
89
- {
90
- "url": "http://memecaptain.com/internet_husband.jpg",
91
- "thumbWidth": 45
92
- },
93
- {
94
- "url": "http://memecaptain.com/joseph_ducreux.jpg",
95
- "thumbWidth": 38
96
- },
97
- {
98
- "url": "http://memecaptain.com/laundry_room_viking.jpg",
99
- "thumbWidth": 67
100
- },
101
- {
102
- "url": "http://memecaptain.com/me_gusta.png",
103
- "thumbWidth": 50
104
- },
105
- {
106
- "url": "http://memecaptain.com/megaman_derp.jpg",
107
- "thumbWidth": 80
108
- },
109
- {
110
- "url": "http://memecaptain.com/most_interesting.jpg",
111
- "thumbWidth": 40
112
- },
113
- {
114
- "url": "http://memecaptain.com/ned_stark.jpg",
115
- "thumbWidth": 55
116
- },
117
- {
118
- "url": "http://memecaptain.com/neil_degrasse_tyson.png",
119
- "thumbWidth": 50
120
- },
121
- {
122
- "url": "http://memecaptain.com/not_bad.png",
123
- "thumbWidth": 50
124
- },
125
- {
126
- "url": "http://memecaptain.com/ok.png",
127
- "thumbWidth": 50
128
- },
129
- {
130
- "url": "http://memecaptain.com/paranoid_parrot.jpg",
131
- "thumbWidth": 50
132
- },
133
- {
134
- "url": "http://memecaptain.com/patrick.jpg",
135
- "thumbWidth": 28
136
- },
137
- {
138
- "url": "http://memecaptain.com/philosoraptor.jpg",
139
- "thumbWidth": 50
140
- },
141
- {
142
- "url": "http://memecaptain.com/rage.png",
143
- "thumbWidth": 50
144
- },
145
- {
146
- "url": "http://memecaptain.com/ron_swanson.jpg",
147
- "thumbWidth": 73
148
- },
149
- {
150
- "url": "http://memecaptain.com/sap.jpg",
151
- "thumbWidth": 50
152
- },
153
- {
154
- "url": "http://memecaptain.com/scumbag_steve.jpg",
155
- "thumbWidth": 50
156
- },
157
- {
158
- "url": "http://memecaptain.com/seriously.png",
159
- "thumbWidth": 50
160
- },
161
- {
162
- "url": "http://memecaptain.com/slowpoke.jpg",
163
- "thumbWidth": 50
164
- },
165
- {
166
- "url": "http://memecaptain.com/socially_awesome_awkward_penguin.jpg",
167
- "thumbWidth": 50
168
- },
169
- {
170
- "url": "http://memecaptain.com/success_kid.jpg",
171
- "thumbWidth": 50
172
- },
173
- {
174
- "url": "http://memecaptain.com/the_more_you_know.jpg",
175
- "thumbWidth": 76
176
- },
177
- {
178
- "url": "http://memecaptain.com/ti_duck.jpg",
179
- "thumbWidth": 50
180
- },
181
- {
182
- "url": "http://memecaptain.com/too_damn_high.jpg",
183
- "thumbWidth": 61
184
- },
185
- {
186
- "url": "http://memecaptain.com/town_crier.jpg",
187
- "thumbWidth": 75
188
- },
189
- {
190
- "url": "http://memecaptain.com/troll_face.jpg",
191
- "thumbWidth": 55
192
- },
193
- {
194
- "url": "http://memecaptain.com/troll_hunter.jpg",
195
- "thumbWidth": 89
196
- },
197
- {
198
- "url": "http://memecaptain.com/trolldad.png",
199
- "thumbWidth": 50
200
- },
201
- {
202
- "url": "http://memecaptain.com/trolldad_dancing.png",
203
- "thumbWidth": 50
204
- },
205
- {
206
- "url": "http://memecaptain.com/tyler_durden.jpg",
207
- "thumbWidth": 50
208
- },
209
- {
210
- "url": "http://memecaptain.com/walter.jpg",
211
- "thumbWidth": 67
212
- },
213
- {
214
- "url": "http://memecaptain.com/wonka.jpg",
215
- "thumbWidth": 50
216
- },
217
- {
218
- "url": "http://memecaptain.com/xzibit.jpg",
219
- "thumbWidth": 77
220
- },
221
- {
222
- "url": "http://memecaptain.com/y_u_no.jpg",
223
- "thumbWidth": 67
224
- },
225
- {
226
- "url": "http://memecaptain.com/yao_ming.jpg",
227
- "thumbWidth": 42
228
- },
229
- {
230
- "url": "http://memecaptain.com/you_should_feel_bad.jpg",
231
- "thumbWidth": 67
232
- }
233
- ]
234
- }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # make a combined thumbnail image from a list of images for use in CSS sprites
4
- # generate source images description json
5
-
6
- require 'json'
7
- require 'optparse'
8
-
9
- require 'RMagick'
10
-
11
- OPTIONS = {
12
- :json_file => 'source_images.json',
13
- :source_url_prefix => '',
14
- :thumb_file => "thumbs_#{Time.now.to_i}.jpg",
15
- :thumb_height => 50,
16
- :url_root => 'http://memecaptain.com/',
17
- }
18
-
19
- OptionParser.new do |opts|
20
- opts.banner = 'usage: thumb_sprites.rb [options] FILE...'
21
-
22
- opts.on('-j', '--json-file JSON_FILE', 'output JSON file path') do |j|
23
- OPTIONS[:json_file] = j
24
- end
25
-
26
- opts.on('-s', '--source-url-prefix SOURCE_URL_PREFIX',
27
- 'source image URL prefix') do |s|
28
- OPTIONS[:source_url_prefix] = s
29
- end
30
-
31
- opts.on('-t', '--thumb-height THUMB_HEIGHT',
32
- 'thumbnail height in pixels') do |t|
33
- OPTIONS[:thumb_height] = t
34
- end
35
-
36
- opts.on('-u', '--url-root URL_ROOT', 'URL root') do |u|
37
- OPTIONS[:url_root] = u
38
- end
39
- end.parse!
40
-
41
- DATA = {
42
- :thumbHeight => OPTIONS[:thumb_height],
43
- :thumbSpritesUrl => "#{OPTIONS[:url_root]}#{OPTIONS[:thumb_file]}",
44
- :images => [],
45
- }
46
-
47
- puts <<eos
48
- source URL prefix: #{OPTIONS[:source_url_prefix]}
49
- thumbnail height: #{OPTIONS[:thumb_height]}
50
- URL root: #{OPTIONS[:url_root]}
51
-
52
- eos
53
-
54
- THUMBS = Magick::ImageList.new
55
-
56
- ARGV.sort.each do |file|
57
- puts " processing #{file}"
58
- image = Magick::ImageList.new(file)
59
- image.resize_to_fit!(0, DATA[:thumbHeight])
60
- image.each do |frame|
61
- THUMBS.push frame
62
- DATA[:images] << {
63
- :url =>
64
- "#{OPTIONS[:url_root]}#{OPTIONS[:source_url_prefix]}#{File.basename(file)}",
65
- :thumbWidth => frame.columns
66
- }
67
- end
68
- end
69
-
70
- open(OPTIONS[:json_file], 'w') do |f|
71
- f.write(JSON.pretty_generate(DATA))
72
- puts "wrote #{OPTIONS[:json_file]}"
73
- end
74
-
75
- THUMBS.append(false).write(OPTIONS[:thumb_file])
76
- puts "wrote #{OPTIONS[:thumb_file]}"
@@ -1,33 +0,0 @@
1
- require 'base64'
2
-
3
- require 'RMagick'
4
- require 'webmock/rspec'
5
-
6
- require 'meme_captain'
7
-
8
- describe MemeCaptain::ImageList::Fetch do
9
-
10
- it 'should load an image from a URL' do
11
- stub_request(:get, 'http://memecaptain.com/good.jpg').to_return(
12
- :body => Base64.decode64(
13
- 'iVBORw0KGgoAAAANSUhEUgAAAcwAAAAyAgMAAACsWgPIAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wBHwQoJY1iyrwAAAAJUExURQAAAAAAAP///4Pdz9IAAAABdFJOUwBA5thmAAAAAWJLR0QB/wIt3gAAAHpJREFUWIXt1zESgCAMRNE03s9mG+9ns6e0EaKCqDOWf4sUJOHREvqciOn7Us0cEZiYmJhnc7HtVbJtS5LsVRo09DScZzmSG5iYmJit2RTVlduGquS920hFvxRMTEzMRzOv6TfKheMX9ThMTEzMnvlj5ld/S0xMTMxjNoGjc3pdi6L4AAAAAElFTkSuQmCC'))
14
-
15
- i = Magick::ImageList.new
16
- i.extend MemeCaptain::ImageList::Fetch
17
- i.fetch! 'http://memecaptain.com/good.jpg'
18
-
19
- i.columns.should == 460
20
- i.rows.should == 50
21
- end
22
-
23
- it 'should raise FetchError if the URL is not found' do
24
- i = Magick::ImageList.new
25
- i.extend MemeCaptain::ImageList::Fetch
26
- stub_request(:get, 'http://memecaptain.com/does_not_exist.jpg').to_return(
27
- :status => 404)
28
- expect {
29
- i.fetch! 'http://memecaptain.com/does_not_exist.jpg'
30
- }.to raise_error(MemeCaptain::ImageList::FetchError)
31
- end
32
-
33
- end
@@ -1,223 +0,0 @@
1
- require 'meme_captain'
2
-
3
- describe MemeCaptain::NormParams do
4
-
5
- def check(input, expected)
6
- norm_params = MemeCaptain::NormParams.new(input)
7
- expected.each { |k,v| norm_params.send(k).should == v }
8
- end
9
-
10
- it 'should leave u as the default if u is not passed in' do
11
- check({}, { :u => '' })
12
- end
13
-
14
- it 'should set u to the empty string if u is passed in as nil' do
15
- check({ :u => nil }, { :u => '' })
16
- end
17
-
18
- it 'should set the u param' do
19
- check({ :u => 'foo' }, { :u => 'foo' })
20
- end
21
-
22
- it 'should leave t1 as the default if t1 is not passed in' do
23
- check({}, { :t1 => '' })
24
- end
25
-
26
- it 'should set t1 to the empty string if t1 is passed in as nil' do
27
- check({ :t1 => nil }, { :t1 => '' })
28
- end
29
-
30
- it 'should set the t1 param' do
31
- check({ :t1 => 'foo' }, { :t1 => 'foo' })
32
- end
33
-
34
- it 'should leave t2 as the default if t2 is not passed in' do
35
- check({}, { :t2 => '' })
36
- end
37
-
38
- it 'should set t2 to the empty string if t2 is passed in as nil' do
39
- check({ :t2 => nil }, { :t2 => '' })
40
- end
41
-
42
- it 'should set the t2 param' do
43
- check({ :t2 => 'foo' }, { :t2 => 'foo' })
44
- end
45
-
46
- it 'should leave t1x as the default if t1x is not passed in' do
47
- check({}, { :t1x => 0.05 })
48
- end
49
-
50
- it 'should leave t1x as the default if t1x is passed in as nil' do
51
- check({ :t1x => nil }, { :t1x => 0.05 })
52
- end
53
-
54
- it 'should leave t1x as the default if t1x is passed in as the empty string' do
55
- check({ :t1x => '' }, { :t1x => 0.05 })
56
- end
57
-
58
- it 'should convert a float t1x to a float' do
59
- check({ :t1x => '1.2' }, { :t1x => 1.2 })
60
- end
61
-
62
- it 'should convert an integer t1x to an integer' do
63
- check({ :t1x => '34' }, { :t1x => 34 })
64
- end
65
-
66
- it 'should leave t1y as the default if t1y is not passed in' do
67
- check({}, { :t1y => 0 })
68
- end
69
-
70
- it 'should leave t1y as the default if t1y is passed in as nil' do
71
- check({ :t1y => nil }, { :t1y => 0 })
72
- end
73
-
74
- it 'should leave t1y as the default if t1y is passed in as the empty string' do
75
- check({ :t1y => '' }, { :t1y => 0 })
76
- end
77
-
78
- it 'should convert a float t1y to a float' do
79
- check({ :t1y => '1.2' }, { :t1y => 1.2 })
80
- end
81
-
82
- it 'should convert an integer t1y to an integer' do
83
- check({ :t1y => '34' }, { :t1y => 34 })
84
- end
85
-
86
- it 'should leave t1w as the default if t1w is not passed in' do
87
- check({}, { :t1w => 0.9 })
88
- end
89
-
90
- it 'should leave t1w as the default if t1w is passed in as nil' do
91
- check({ :t1w => nil }, { :t1w => 0.9 })
92
- end
93
-
94
- it 'should leave t1w as the default if t1w is passed in as the empty string' do
95
- check({ :t1w => '' }, { :t1w => 0.9 })
96
- end
97
-
98
- it 'should convert a float t1w to a float' do
99
- check({ :t1w => '1.2' }, { :t1w => 1.2 })
100
- end
101
-
102
- it 'should convert an integer t1w to an integer' do
103
- check({ :t1w => '34' }, { :t1w => 34 })
104
- end
105
-
106
- it 'should leave t1h as the default if t1h is not passed in' do
107
- check({}, { :t1h => 0.25 })
108
- end
109
-
110
- it 'should leave t1h as the default if t1h is passed in as nil' do
111
- check({ :t1h => nil }, { :t1h => 0.25 })
112
- end
113
-
114
- it 'should leave t1h as the default if t1h is passed in as the empty string' do
115
- check({ :t1h => '' }, { :t1h => 0.25 })
116
- end
117
-
118
- it 'should convert a float t1h to a float' do
119
- check({ :t1h => '1.2' }, { :t1h => 1.2 })
120
- end
121
-
122
- it 'should convert an integer t1h to an integer' do
123
- check({ :t1h => '34' }, { :t1h => 34 })
124
- end
125
-
126
- it 'should leave t2x as the default if t2x is not passed in' do
127
- check({}, { :t2x => 0.05 })
128
- end
129
-
130
- it 'should leave t2x as the default if t2x is passed in as nil' do
131
- check({ :t2x => nil }, { :t2x => 0.05 })
132
- end
133
-
134
- it 'should leave t2x as the default if t2x is passed in as the empty string' do
135
- check({ :t2x => '' }, { :t2x => 0.05 })
136
- end
137
-
138
- it 'should convert a float t2x to a float' do
139
- check({ :t2x => '1.2' }, { :t2x => 1.2 })
140
- end
141
-
142
- it 'should convert an integer t2x to an integer' do
143
- check({ :t2x => '34' }, { :t2x => 34 })
144
- end
145
-
146
- it 'should leave t2y as the default if t2y is not passed in' do
147
- check({}, { :t2y => 0.75 })
148
- end
149
-
150
- it 'should leave t2y as the default if t2y is passed in as nil' do
151
- check({ :t2y => nil }, { :t2y => 0.75 })
152
- end
153
-
154
- it 'should leave t2y as the default if t2y is passed in as the empty string' do
155
- check({ :t2y => '' }, { :t2y => 0.75 })
156
- end
157
-
158
- it 'should convert a float t2y to a float' do
159
- check({ :t2y => '1.2' }, { :t2y => 1.2 })
160
- end
161
-
162
- it 'should convert an integer t2y to an integer' do
163
- check({ :t2y => '34' }, { :t2y => 34 })
164
- end
165
-
166
- it 'should leave t2w as the default if t2w is not passed in' do
167
- check({}, { :t2w => 0.9 })
168
- end
169
-
170
- it 'should leave t2w as the default if t2w is passed in as nil' do
171
- check({ :t2w => nil }, { :t2w => 0.9 })
172
- end
173
-
174
- it 'should leave t2w as the default if t2w is passed in as the empty string' do
175
- check({ :t2w => '' }, { :t2w => 0.9 })
176
- end
177
-
178
- it 'should convert a float t2w to a float' do
179
- check({ :t2w => '1.2' }, { :t2w => 1.2 })
180
- end
181
-
182
- it 'should convert an integer t2w to an integer' do
183
- check({ :t2w => '34' }, { :t2w => 34 })
184
- end
185
-
186
- it 'should leave t2h as the default if t2h is not passed in' do
187
- check({}, { :t2h => 0.25 })
188
- end
189
-
190
- it 'should leave t2h as the default if t2h is passed in as nil' do
191
- check({ :t2h => nil }, { :t2h => 0.25 })
192
- end
193
-
194
- it 'should leave t2h as the default if t2h is passed in as the empty string' do
195
- check({ :t2h => '' }, { :t2h => 0.25 })
196
- end
197
-
198
- it 'should convert a float t2h to a float' do
199
- check({ :t2h => '1.2' }, { :t2h => 1.2 })
200
- end
201
-
202
- it 'should convert an integer t2h to an integer' do
203
- check({ :t2h => '34' }, { :t2h => 34 })
204
- end
205
-
206
- it 'should generate the correct signature' do
207
- MemeCaptain::NormParams.new(
208
- :t1 => 'text 1',
209
- :t1h => '1',
210
- :t1w => '2',
211
- :t1x => '3',
212
- :t1y => '4',
213
- :t2 => 'text 2',
214
- :t2h => '5',
215
- :t2w => '6',
216
- :t2x => '7',
217
- :t2y => '8',
218
- :u => 'some u'
219
- ).signature.should ==
220
- 't1text 1t1h1t1w2t1x3t1y4t2text 2t2h5t2w6t2x7t2y8usome u'
221
- end
222
-
223
- end