cornify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +20 -0
- data/README.md +53 -0
- data/Rakefile +35 -0
- data/VERSION +1 -0
- data/cornify.gemspec +55 -0
- data/lib/cornify.rb +125 -0
- metadata +108 -0
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.3-p194@global
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec"
|
10
|
+
gem "bundler", "~> 1"
|
11
|
+
gem "jeweler", "~> 1.8.4"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.7.5)
|
12
|
+
rake (0.9.2.2)
|
13
|
+
rdoc (3.12)
|
14
|
+
json (~> 1.4)
|
15
|
+
rspec (2.11.0)
|
16
|
+
rspec-core (~> 2.11.0)
|
17
|
+
rspec-expectations (~> 2.11.0)
|
18
|
+
rspec-mocks (~> 2.11.0)
|
19
|
+
rspec-core (2.11.1)
|
20
|
+
rspec-expectations (2.11.3)
|
21
|
+
diff-lcs (~> 1.1.3)
|
22
|
+
rspec-mocks (2.11.3)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 1)
|
29
|
+
jeweler (~> 1.8.4)
|
30
|
+
rspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 James Hart
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# cornify
|
2
|
+
|
3
|
+
Do you ever take a step back from web design and think to yourself, "This website would be so much more awesome if it had twice, even thrice as many unicorns!"?
|
4
|
+
|
5
|
+
Well, you're in luck, pardner. Using this here gem you can add as many unicorns as you want at the click of a button! And even a touch of pink comic sans!
|
6
|
+
|
7
|
+
## Prerequisites
|
8
|
+
|
9
|
+
Rails, but you could probably pull this off with only ActionPack (not tested)
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Put this in your Gemfile
|
14
|
+
|
15
|
+
gem 'cornify'
|
16
|
+
|
17
|
+
And bundle. You can now use these helpers in your views!
|
18
|
+
|
19
|
+
Say, in your show.html.erb:
|
20
|
+
|
21
|
+
<%= cornify_link %>
|
22
|
+
|
23
|
+
Would product a button that allows you to click it to create unicorns on demand!
|
24
|
+
|
25
|
+
Soooo many advanced coadskillz:
|
26
|
+
|
27
|
+
<%= cornify_link "This here be's a link to cornify", :class => "corniest", :id => "so_corny" %>
|
28
|
+
|
29
|
+
Secret treats!
|
30
|
+
|
31
|
+
<%= cornify_link :rainbow_madness %>
|
32
|
+
|
33
|
+
|
34
|
+
All credit goes to cornify.com!
|
35
|
+
http://www.cornify.com
|
36
|
+
|
37
|
+
And a little fun CSS3 trick to this thread:
|
38
|
+
http://css-tricks.com/forums/discussion/16668/css3-buttons/p1
|
39
|
+
|
40
|
+
|
41
|
+
## Contributing to cornify
|
42
|
+
|
43
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
44
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
45
|
+
* Fork the project.
|
46
|
+
* Start a feature/bugfix branch.
|
47
|
+
* Commit and push until you are happy with your contribution.
|
48
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
49
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
50
|
+
|
51
|
+
## Copyright
|
52
|
+
|
53
|
+
The fuck?
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "cornify"
|
18
|
+
gem.homepage = "http://github.com/hjhart/cornify"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{And James said, "Let there be unicorns, and all was good."}
|
21
|
+
gem.description = %Q{And James said, "Let there be unicorns, and all was good."}
|
22
|
+
gem.email = "hjhart@gmail.com"
|
23
|
+
gem.authors = ["James Hart"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/cornify.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "cornify"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["James Hart"]
|
12
|
+
s.date = "2012-11-09"
|
13
|
+
s.description = "And James said, \"Let there be unicorns, and all was good.\""
|
14
|
+
s.email = "hjhart@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rvmrc",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"cornify.gemspec",
|
29
|
+
"lib/cornify.rb"
|
30
|
+
]
|
31
|
+
s.homepage = "http://github.com/hjhart/cornify"
|
32
|
+
s.licenses = ["MIT"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = "1.8.24"
|
35
|
+
s.summary = "And James said, \"Let there be unicorns, and all was good.\""
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
42
|
+
s.add_development_dependency(%q<bundler>, ["~> 1"])
|
43
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
46
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
47
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
48
|
+
end
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
51
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/lib/cornify.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers #:nodoc:
|
3
|
+
module Cornify
|
4
|
+
def cornify_link(content=nil, options = {})
|
5
|
+
|
6
|
+
attributes = {
|
7
|
+
:href => "javascript:cornify_add()"
|
8
|
+
}
|
9
|
+
|
10
|
+
if content == :rainbow_madness
|
11
|
+
attributes[:class] = 'rb-candy'
|
12
|
+
options = options.merge(attributes)
|
13
|
+
|
14
|
+
content = 'Rainbow Madness!!'
|
15
|
+
hyperlink = content_tag("a", content, options)
|
16
|
+
(cornify_javascript + cornify_rainbow_button_style + hyperlink).html_safe
|
17
|
+
else
|
18
|
+
content ||= 'Click here to Cornify!!'
|
19
|
+
options = options.merge(attributes)
|
20
|
+
hyperlink = content_tag("a", content, options)
|
21
|
+
(cornify_javascript + hyperlink).html_safe
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def cornify_javascript
|
28
|
+
'<script type="text/javascript" src="http://www.cornify.com/js/cornify.js"></script>'
|
29
|
+
end
|
30
|
+
|
31
|
+
def cornify_rainbow_button_style
|
32
|
+
<<CSS
|
33
|
+
<style type="text/css">
|
34
|
+
.rb-candy {
|
35
|
+
cursor:pointer;
|
36
|
+
font:normal 18px 'Comic Sans MS',Serif;
|
37
|
+
background-color:grey;
|
38
|
+
background-image:-webkit-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
|
39
|
+
background-image:-moz-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
|
40
|
+
background-image:-ms-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
|
41
|
+
background-image:-o-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
|
42
|
+
background-image:linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
|
43
|
+
border:none;
|
44
|
+
padding:10px 18px;
|
45
|
+
color:white;
|
46
|
+
text-shadow:0px 1px 0px rgba(0,0,0,0.2), 0px 0px 10px white;
|
47
|
+
-webkit-box-shadow:inset 0px -1px 10px rgba(255,255,255,0.7),
|
48
|
+
0px 1px 3px rgba(0,0,0,0.4);
|
49
|
+
-moz-box-shadow:inset 0px -1px 10px rgba(255,255,255,0.7),
|
50
|
+
0px 1px 3px rgba(0,0,0,0.4);
|
51
|
+
box-shadow:inset 0px -1px 10px rgba(255,255,255,0.7),
|
52
|
+
0px 1px 3px rgba(0,0,0,0.4);
|
53
|
+
-webkit-border-radius:30px;
|
54
|
+
-moz-border-radius:30px;
|
55
|
+
border-radius:30px;
|
56
|
+
-webkit-transition:top 0.26s ease-out;
|
57
|
+
-moz-transition:top 0.26s ease-out;
|
58
|
+
-ms-transition:top 0.26s ease-out;
|
59
|
+
-o-transition:top 0.26s ease-out;
|
60
|
+
transition:top 0.26s ease-out;
|
61
|
+
position:relative;
|
62
|
+
text-decoration: none;
|
63
|
+
}
|
64
|
+
.rb-candy:hover {
|
65
|
+
background-color:red;
|
66
|
+
-webkit-animation:rainbow 0.5s infinite alternate;
|
67
|
+
-moz-animation:rainbow 0.5s infinite alternate;
|
68
|
+
-ms-animation:rainbow 0.5s infinite alternate;
|
69
|
+
-o-animation:rainbow 0.5s infinite alternate;
|
70
|
+
animation:rainbow 0.5s infinite alternate;
|
71
|
+
}
|
72
|
+
.rb-candy:focus {
|
73
|
+
-webkit-animation-play-state:paused;
|
74
|
+
-moz-animation-play-state:paused;
|
75
|
+
-o-animation-play-state:paused;
|
76
|
+
animation-play-state:paused;
|
77
|
+
}
|
78
|
+
@-webkit-keyframes rainbow {
|
79
|
+
0% {background-color:red;top:-2px; }
|
80
|
+
20% {background-color:gold;top:0px; }
|
81
|
+
40% {background-color:yellow;top:-2px; }
|
82
|
+
60% {background-color:yellowgreen;top:0px;}
|
83
|
+
80% {background-color:skyblue;top:-2px; }
|
84
|
+
100% {background-color:indigo;top:0px; }
|
85
|
+
}
|
86
|
+
@-moz-keyframes rainbow {
|
87
|
+
0% {background-color:red;top:-2px; }
|
88
|
+
20% {background-color:gold;top:0px; }
|
89
|
+
40% {background-color:yellow;top:-2px; }
|
90
|
+
60% {background-color:yellowgreen;top:0px;}
|
91
|
+
80% {background-color:skyblue;top:-2px; }
|
92
|
+
100% {background-color:indigo;top:0px; }
|
93
|
+
}
|
94
|
+
@-ms-keyframes rainbow {
|
95
|
+
0% {background-color:red;top:-2px; }
|
96
|
+
20% {background-color:gold;top:0px; }
|
97
|
+
40% {background-color:yellow;top:-2px; }
|
98
|
+
60% {background-color:yellowgreen;top:0px;}
|
99
|
+
80% {background-color:skyblue;top:-2px; }
|
100
|
+
100% {background-color:indigo;top:0px; }
|
101
|
+
}
|
102
|
+
@-o-keyframes rainbow {
|
103
|
+
0% {background-color:red;top:-2px; }
|
104
|
+
20% {background-color:gold;top:0px; }
|
105
|
+
40% {background-color:yellow;top:-2px; }
|
106
|
+
60% {background-color:yellowgreen;top:0px;}
|
107
|
+
80% {background-color:skyblue;top:-2px; }
|
108
|
+
100% {background-color:indigo;top:0px; }
|
109
|
+
}
|
110
|
+
@keyframes rainbow {
|
111
|
+
0% {background-color:red;top:-2px; }
|
112
|
+
20% {background-color:gold;top:0px; }
|
113
|
+
40% {background-color:yellow;top:-2px; }
|
114
|
+
60% {background-color:yellowgreen;top:0px;}
|
115
|
+
80% {background-color:skyblue;top:-2px; }
|
116
|
+
100% {background-color:indigo;top:0px; }
|
117
|
+
}
|
118
|
+
</style>
|
119
|
+
CSS
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
include ActionView::Helpers::Cornify
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cornify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- James Hart
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jeweler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.4
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.4
|
62
|
+
description: And James said, "Let there be unicorns, and all was good."
|
63
|
+
email: hjhart@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
files:
|
70
|
+
- .document
|
71
|
+
- .rvmrc
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- VERSION
|
78
|
+
- cornify.gemspec
|
79
|
+
- lib/cornify.rb
|
80
|
+
homepage: http://github.com/hjhart/cornify
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: 202710118395194493
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.24
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: And James said, "Let there be unicorns, and all was good."
|
108
|
+
test_files: []
|