twigg-app 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/data/quips.yml +45 -0
  3. data/lib/twigg-app/app/quips.rb +13 -0
  4. data/lib/twigg-app/app/routes.rb +43 -0
  5. data/lib/twigg-app/app/server.rb +146 -0
  6. data/lib/twigg-app/app/version.rb +5 -0
  7. data/lib/twigg-app/app.rb +14 -0
  8. data/lib/twigg-app.rb +5 -0
  9. data/public/application.js +106 -0
  10. data/public/favicon.ico +0 -0
  11. data/public/favicon.png +0 -0
  12. data/public/vendor/bootstrap/CNAME +1 -0
  13. data/public/vendor/bootstrap/CONTRIBUTING.md +66 -0
  14. data/public/vendor/bootstrap/Gruntfile.js +195 -0
  15. data/public/vendor/bootstrap/LICENSE +176 -0
  16. data/public/vendor/bootstrap/README.md +139 -0
  17. data/public/vendor/bootstrap/_config.yml +28 -0
  18. data/public/vendor/bootstrap/_includes/ads.html +1 -0
  19. data/public/vendor/bootstrap/_includes/footer.html +33 -0
  20. data/public/vendor/bootstrap/_includes/header.html +43 -0
  21. data/public/vendor/bootstrap/_includes/nav-components.html +135 -0
  22. data/public/vendor/bootstrap/_includes/nav-css.html +77 -0
  23. data/public/vendor/bootstrap/_includes/nav-customize.html +40 -0
  24. data/public/vendor/bootstrap/_includes/nav-getting-started.html +28 -0
  25. data/public/vendor/bootstrap/_includes/nav-javascript.html +88 -0
  26. data/public/vendor/bootstrap/_includes/nav-main.html +32 -0
  27. data/public/vendor/bootstrap/_includes/old-bs-docs.html +8 -0
  28. data/public/vendor/bootstrap/_includes/social-buttons.html +16 -0
  29. data/public/vendor/bootstrap/_layouts/customize.html +52 -0
  30. data/public/vendor/bootstrap/_layouts/default.html +72 -0
  31. data/public/vendor/bootstrap/_layouts/home.html +43 -0
  32. data/public/vendor/bootstrap/assets/css/docs.css +896 -0
  33. data/public/vendor/bootstrap/assets/css/pygments-manni.css +66 -0
  34. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  35. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  36. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  37. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  38. data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
  39. data/public/vendor/bootstrap/assets/js/application.js +82 -0
  40. data/public/vendor/bootstrap/assets/js/customizer.js +175 -0
  41. data/public/vendor/bootstrap/assets/js/holder.js +419 -0
  42. data/public/vendor/bootstrap/assets/js/html5shiv.js +8 -0
  43. data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +1287 -0
  44. data/public/vendor/bootstrap/assets/js/jquery.js +5 -0
  45. data/public/vendor/bootstrap/assets/js/jszip.js +1425 -0
  46. data/public/vendor/bootstrap/assets/js/less.js +9 -0
  47. data/public/vendor/bootstrap/assets/js/respond.min.js +6 -0
  48. data/public/vendor/bootstrap/assets/js/uglify.js +14 -0
  49. data/public/vendor/bootstrap/bower.json +11 -0
  50. data/public/vendor/bootstrap/browserstack.json +37 -0
  51. data/public/vendor/bootstrap/components.html +2555 -0
  52. data/public/vendor/bootstrap/composer.json +20 -0
  53. data/public/vendor/bootstrap/css.html +2276 -0
  54. data/public/vendor/bootstrap/customize.html +1480 -0
  55. data/public/vendor/bootstrap/dist/css/bootstrap.css +5579 -0
  56. data/public/vendor/bootstrap/dist/css/bootstrap.min.css +9 -0
  57. data/public/vendor/bootstrap/dist/js/bootstrap.js +1993 -0
  58. data/public/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
  59. data/public/vendor/bootstrap/getting-started.html +375 -0
  60. data/public/vendor/bootstrap/index.html +16 -0
  61. data/public/vendor/bootstrap/javascript.html +1904 -0
  62. data/public/vendor/bootstrap/js/affix.js +126 -0
  63. data/public/vendor/bootstrap/js/alert.js +98 -0
  64. data/public/vendor/bootstrap/js/button.js +109 -0
  65. data/public/vendor/bootstrap/js/carousel.js +217 -0
  66. data/public/vendor/bootstrap/js/collapse.js +179 -0
  67. data/public/vendor/bootstrap/js/dropdown.js +154 -0
  68. data/public/vendor/bootstrap/js/modal.js +244 -0
  69. data/public/vendor/bootstrap/js/popover.js +117 -0
  70. data/public/vendor/bootstrap/js/scrollspy.js +158 -0
  71. data/public/vendor/bootstrap/js/tab.js +135 -0
  72. data/public/vendor/bootstrap/js/tests/index.html +52 -0
  73. data/public/vendor/bootstrap/js/tests/phantom.js +63 -0
  74. data/public/vendor/bootstrap/js/tests/server.js +14 -0
  75. data/public/vendor/bootstrap/js/tests/unit/affix.js +25 -0
  76. data/public/vendor/bootstrap/js/tests/unit/alert.js +62 -0
  77. data/public/vendor/bootstrap/js/tests/unit/button.js +116 -0
  78. data/public/vendor/bootstrap/js/tests/unit/carousel.js +87 -0
  79. data/public/vendor/bootstrap/js/tests/unit/collapse.js +164 -0
  80. data/public/vendor/bootstrap/js/tests/unit/dropdown.js +219 -0
  81. data/public/vendor/bootstrap/js/tests/unit/modal.js +177 -0
  82. data/public/vendor/bootstrap/js/tests/unit/phantom.js +69 -0
  83. data/public/vendor/bootstrap/js/tests/unit/popover.js +133 -0
  84. data/public/vendor/bootstrap/js/tests/unit/scrollspy.js +37 -0
  85. data/public/vendor/bootstrap/js/tests/unit/tab.js +86 -0
  86. data/public/vendor/bootstrap/js/tests/unit/tooltip.js +437 -0
  87. data/public/vendor/bootstrap/js/tests/unit/transition.js +13 -0
  88. data/public/vendor/bootstrap/js/tests/vendor/jquery.js +5 -0
  89. data/public/vendor/bootstrap/js/tests/vendor/qunit.css +232 -0
  90. data/public/vendor/bootstrap/js/tests/vendor/qunit.js +1510 -0
  91. data/public/vendor/bootstrap/js/tooltip.js +382 -0
  92. data/public/vendor/bootstrap/js/transition.js +56 -0
  93. data/public/vendor/bootstrap/less/alerts.less +71 -0
  94. data/public/vendor/bootstrap/less/badges.less +51 -0
  95. data/public/vendor/bootstrap/less/bootstrap.less +63 -0
  96. data/public/vendor/bootstrap/less/breadcrumbs.less +23 -0
  97. data/public/vendor/bootstrap/less/button-groups.less +244 -0
  98. data/public/vendor/bootstrap/less/buttons.less +159 -0
  99. data/public/vendor/bootstrap/less/carousel.less +204 -0
  100. data/public/vendor/bootstrap/less/close.less +33 -0
  101. data/public/vendor/bootstrap/less/code.less +56 -0
  102. data/public/vendor/bootstrap/less/component-animations.less +29 -0
  103. data/public/vendor/bootstrap/less/dropdowns.less +176 -0
  104. data/public/vendor/bootstrap/less/forms.less +332 -0
  105. data/public/vendor/bootstrap/less/grid.less +340 -0
  106. data/public/vendor/bootstrap/less/input-groups.less +127 -0
  107. data/public/vendor/bootstrap/less/jumbotron.less +29 -0
  108. data/public/vendor/bootstrap/less/labels.less +54 -0
  109. data/public/vendor/bootstrap/less/list-group.less +88 -0
  110. data/public/vendor/bootstrap/less/media.less +56 -0
  111. data/public/vendor/bootstrap/less/mixins.less +693 -0
  112. data/public/vendor/bootstrap/less/modals.less +133 -0
  113. data/public/vendor/bootstrap/less/navbar.less +559 -0
  114. data/public/vendor/bootstrap/less/navs.less +228 -0
  115. data/public/vendor/bootstrap/less/normalize.less +396 -0
  116. data/public/vendor/bootstrap/less/pager.less +55 -0
  117. data/public/vendor/bootstrap/less/pagination.less +72 -0
  118. data/public/vendor/bootstrap/less/panels.less +128 -0
  119. data/public/vendor/bootstrap/less/popovers.less +133 -0
  120. data/public/vendor/bootstrap/less/print.less +100 -0
  121. data/public/vendor/bootstrap/less/progress-bars.less +99 -0
  122. data/public/vendor/bootstrap/less/responsive-utilities.less +149 -0
  123. data/public/vendor/bootstrap/less/scaffolding.less +111 -0
  124. data/public/vendor/bootstrap/less/tables.less +211 -0
  125. data/public/vendor/bootstrap/less/thumbnails.less +42 -0
  126. data/public/vendor/bootstrap/less/tooltip.less +95 -0
  127. data/public/vendor/bootstrap/less/type.less +238 -0
  128. data/public/vendor/bootstrap/less/utilities.less +42 -0
  129. data/public/vendor/bootstrap/less/variables.less +607 -0
  130. data/public/vendor/bootstrap/less/wells.less +29 -0
  131. data/public/vendor/bootstrap/package.json +33 -0
  132. data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +3 -0
  133. data/public/vendor/bootstrap-glyphicons/CNAME +1 -0
  134. data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +54 -0
  135. data/public/vendor/bootstrap-glyphicons/LICENSE +19 -0
  136. data/public/vendor/bootstrap-glyphicons/README.md +61 -0
  137. data/public/vendor/bootstrap-glyphicons/_config.yml +12 -0
  138. data/public/vendor/bootstrap-glyphicons/composer.json +9 -0
  139. data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +2 -0
  140. data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +9 -0
  141. data/public/vendor/bootstrap-glyphicons/css/docs.css +160 -0
  142. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
  143. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
  144. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +175 -0
  145. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
  146. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
  147. data/public/vendor/bootstrap-glyphicons/index.html +255 -0
  148. data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +201 -0
  149. data/public/vendor/bootstrap-glyphicons/package.json +18 -0
  150. data/public/vendor/d3/LICENSE +26 -0
  151. data/public/vendor/d3/README.md +7 -0
  152. data/public/vendor/d3/bower.json +25 -0
  153. data/public/vendor/d3/d3.js +8810 -0
  154. data/public/vendor/d3/d3.min.js +5 -0
  155. data/public/vendor/jquery/README.md +11 -0
  156. data/public/vendor/jquery/bower.json +11 -0
  157. data/public/vendor/jquery/component.json +15 -0
  158. data/public/vendor/jquery/composer.json +35 -0
  159. data/public/vendor/jquery/jquery-migrate.js +511 -0
  160. data/public/vendor/jquery/jquery-migrate.min.js +3 -0
  161. data/public/vendor/jquery/jquery.js +8829 -0
  162. data/public/vendor/jquery/jquery.min.js +6 -0
  163. data/public/vendor/jquery/jquery.min.map +1 -0
  164. data/public/vendor/jquery/package.json +7 -0
  165. data/public/vendor/replacejs/CHANGELOG.md +3 -0
  166. data/public/vendor/replacejs/MIT-LICENSE.txt +20 -0
  167. data/public/vendor/replacejs/README.md +123 -0
  168. data/public/vendor/replacejs/bower.json +24 -0
  169. data/public/vendor/replacejs/primer.js +17 -0
  170. data/public/vendor/replacejs/primer.min.js +1 -0
  171. data/public/vendor/replacejs/replace.js +182 -0
  172. data/public/vendor/stupidtable.js +158 -0
  173. data/views/dashboard.haml +17 -0
  174. data/views/layout.haml +60 -0
  175. metadata +330 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0c91cf12c7556b35c7d83003c68f8cdda885bf24
4
+ data.tar.gz: b05d038bf66594e083ccf7937b5bcb05d3de767b
5
+ SHA512:
6
+ metadata.gz: c2a19d6e1be2de3056b4d1884b5f2da4052447d4dc57d68a8a478d82f0f85c7c942ba2fa0d0ea38cbc3b540be344a9af331351c883cadd9165dcf939c55e02c7
7
+ data.tar.gz: 0d4bf0966d6c8e6490bf97b8dbfa14418f3b4dcb967d91eefec177ec48df35bcb4512433f3cd3fc26cca6fc83f70f52d2726081da03712ece354a73abf88bbcb
data/data/quips.yml ADDED
@@ -0,0 +1,45 @@
1
+ ---
2
+ - "Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law."
3
+ - "The three chief virtues of a programmer are: laziness, impatience and hubris."
4
+ - A program that produces incorrect results twice as fast is infinitely slower.
5
+ - Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
6
+ - Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
7
+ - Before I step into a puddle, I'd like to know how deep it is.
8
+ - Before software can be reusable it first has to be usable.
9
+ - Complexity has nothing to do with intelligence, simplicity does.
10
+ - Computers are good at following instructions, but not at reading your mind.
11
+ - Controlling complexity is the essence of computer programming.
12
+ - Deleted code is debugged code.
13
+ - Depth before breadth.
14
+ - Done is better than perfect.
15
+ - Given enough eyeballs, all bugs are shallow.
16
+ - I hate code, and I want as little of it as possible in our product.
17
+ - I have always found that plans are useless, but planning is indispensable.
18
+ - If debugging is the process of removing software bugs, then programming must be the process of putting them in.
19
+ - If it doesn’t work, it doesn’t matter how fast it doesn’t work.
20
+ - If you are not embarrassed by the first version of your product, you've launched too late.
21
+ - In programming the hard part isn’t solving problems, but deciding what problems to solve.
22
+ - Leave it better.
23
+ - Make everything as simple as possible, but not simpler.
24
+ - Measuring programming progress by lines of code is like measuring aircraft building progress by weight.
25
+ - No code is faster than no code.
26
+ - Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
27
+ - Premature optimization is the root of all evil.
28
+ - Programming can be fun, so can cryptography; however they should not be combined.
29
+ - Programs must be written for people to read, and only incidentally for machines to execute.
30
+ - Real artists ship.
31
+ - Seek first to understand, and then be understood.
32
+ - Ship early and often.
33
+ - Simplicity carried to the extreme becomes elegance.
34
+ - Simplicity is prerequisite for reliability.
35
+ - Simplicity is the ultimate sophistication.
36
+ - The best way to predict the future is to implement it.
37
+ - The central enemy of reliability is complexity.
38
+ - The cheapest, fastest, and most reliable components are those that aren't there.
39
+ - The computing scientist's main challenge is not to get confused by the complexities of his own making.
40
+ - The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
41
+ - The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.
42
+ - The unavoidable price of reliability is simplicity.
43
+ - The whole point of getting things done is knowing what to leave undone.
44
+ - When in doubt, leave it out.
45
+ - You have to break eggs to make an omelet.
@@ -0,0 +1,13 @@
1
+ require 'yaml'
2
+
3
+ module Twigg
4
+ module App
5
+ module Quips
6
+ QUIPS = YAML.load_file(App.root + 'data' + 'quips.yml')
7
+
8
+ def self.random
9
+ QUIPS.sample
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,43 @@
1
+ module Twigg
2
+ module App
3
+ module Routes
4
+ def author_path(author)
5
+ '/authors/' + author.tr(' ', '.')
6
+ end
7
+
8
+ def authors_path(options = {})
9
+ '/authors' + query_string_from_options(options)
10
+ end
11
+
12
+ def gerrit_authors_path
13
+ '/gerrit/authors'
14
+ end
15
+
16
+ def gerrit_changes_path
17
+ '/gerrit'
18
+ end
19
+
20
+ def pairs_path(options = {})
21
+ '/pairs' + query_string_from_options(options)
22
+ end
23
+
24
+ def russian_novels_path(options = {})
25
+ '/russian-novels' + query_string_from_options(options)
26
+ end
27
+
28
+ def team_path(team)
29
+ '/teams/' + team.tr(' ', '.')
30
+ end
31
+
32
+ def teams_path(options = {})
33
+ '/teams' + query_string_from_options(options)
34
+ end
35
+
36
+ private
37
+
38
+ def query_string_from_options(options)
39
+ options.empty? ? '' : "?#{::URI.encode_www_form(options)}"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,146 @@
1
+ require 'compass'
2
+ require 'haml'
3
+ require 'json'
4
+ require 'sass'
5
+ require 'sinatra'
6
+ require 'sinatra/content_for'
7
+ require 'sinatra/respond_with'
8
+ require 'yaml'
9
+
10
+ module Twigg
11
+ module App
12
+ class Server < Sinatra::Base
13
+ extend Dependency
14
+
15
+ set :bind, Config.app.bind
16
+ set :public_dir, App.root + 'public'
17
+ set :views, App.root + 'views'
18
+
19
+ configure do
20
+ Compass.configuration do |config|
21
+ config.project_path = __dir__
22
+ config.sass_dir = 'views/stylesheets'
23
+ end
24
+
25
+ set :sass, Compass.sass_engine_options
26
+ set :scss, Compass.sass_engine_options
27
+ end
28
+
29
+ configure :development do
30
+ require 'sinatra/reloader'
31
+ register Sinatra::Reloader
32
+
33
+ # watch for changes to lib files of any twigg gems
34
+ also_reload App.root + '../*/lib/**/*'
35
+ end
36
+
37
+ register Sinatra::RespondWith
38
+
39
+ helpers Sinatra::ContentFor
40
+ helpers Twigg::App::Routes
41
+ helpers Twigg::Util
42
+
43
+ helpers do
44
+ # Returns true if the current request corresponds to any path in
45
+ # `paths`.
46
+ def active?(*paths)
47
+ 'active' if Array(paths).include?(request.path_info)
48
+ end
49
+
50
+ def day_links
51
+ {
52
+ class: 'day-links glyphicon glyphicon-time',
53
+ data: { toggle: 'popover', content: haml(:'/shared/day_links') },
54
+ title: 'Other time intervals',
55
+ }
56
+ end
57
+
58
+ def strip_tags(html)
59
+ require 'nokogiri'
60
+ Nokogiri::HTML(html).text
61
+ end
62
+
63
+ def name_to_id(name)
64
+ name.tr(' .@', '-').downcase
65
+ end
66
+
67
+ def slug_to_name(slug)
68
+ slug.tr('.', ' ')
69
+ end
70
+
71
+ def random_quip
72
+ Quips.random
73
+ end
74
+ end
75
+
76
+ before do
77
+ @days = params[:days].to_i
78
+ @days = Config.default_days if @days.zero?
79
+ end
80
+
81
+ get '/' do
82
+ haml :dashboard
83
+ end
84
+
85
+ get '/authors' do
86
+ @commit_set = Gatherer.gather(Config.repositories_directory, @days)
87
+ haml :'authors/index', layout: !request.xhr?
88
+ end
89
+
90
+ get '/authors/:slug' do
91
+ @author = slug_to_name(params[:slug])
92
+ @commit_set = Gatherer.gather(Config.repositories_directory, @days).
93
+ select_author(@author)
94
+ @nvd3_data = @commit_set.count_by_day(@days)
95
+ haml :'authors/show'
96
+ end
97
+
98
+ if Config.app.gerrit.enabled
99
+ with_dependency 'twigg-gerrit' do
100
+ get '/gerrit' do
101
+ @changes = Gerrit::Change.changes
102
+ haml :'gerrit/index', layout: !request.xhr?
103
+ end
104
+
105
+ get '/gerrit/authors' do
106
+ @authors = Gerrit::Author.stats(days: @days)
107
+ haml :'gerrit/authors'
108
+ end
109
+ end
110
+ end
111
+
112
+ get '/pairs' do
113
+ @pairs = Gatherer.gather(Config.repositories_directory, @days).pairs
114
+ haml :'pairs/index', layout: !request.xhr?
115
+ end
116
+
117
+ get '/russian-novels', provides: %i[html json] do
118
+ respond_to do |f|
119
+ f.html { haml :'russian-novels/index' }
120
+ f.json {
121
+ commit_set = Gatherer.gather(Config.repositories_directory, @days)
122
+ RussianNovel.new(commit_set).data.to_json
123
+ }
124
+ end
125
+ end
126
+
127
+ get '/stylesheets/:name.css' do
128
+ content_type 'text/css', charset: 'utf-8'
129
+ scss :"stylesheets/#{params[:name]}"
130
+ end
131
+
132
+ get '/teams' do
133
+ @commit_set = Gatherer.gather(Config.repositories_directory, @days)
134
+ haml :'teams/index', layout: !request.xhr?
135
+ end
136
+
137
+ get '/teams/:slug' do
138
+ @team = slug_to_name(params[:slug])
139
+ @commit_set = Gatherer.gather(Config.repositories_directory, @days).
140
+ select_team(@team)
141
+ @nvd3_data = @commit_set.count_by_day(@days)
142
+ haml :'teams/show'
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,5 @@
1
+ module Twigg
2
+ module App
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ module Twigg
2
+ module App
3
+ autoload :Quips, 'twigg-app/app/quips'
4
+ autoload :Routes, 'twigg-app/app/routes'
5
+ autoload :Server, 'twigg-app/app/server'
6
+ autoload :VERSION, 'twigg-app/app/version'
7
+
8
+ # Returns a Pathname instance corresponding to the root directory of the gem
9
+ # (ie. the directory containing the `lib`, `public` and `views` directories).
10
+ def self.root
11
+ Pathname.new(__dir__) + '..' + '..'
12
+ end
13
+ end
14
+ end
data/lib/twigg-app.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'twigg'
2
+
3
+ module Twigg
4
+ autoload :App, 'twigg-app/app'
5
+ end
@@ -0,0 +1,106 @@
1
+ Twigg = {};
2
+ Twigg.Profile = (function() {
3
+ var loadCommitsPerDay = function(selector, data) {
4
+ var height = 200,
5
+ width = $('#bar-chart').width(),
6
+ padding = 45,
7
+ barSpacing = 1,
8
+ barWidth = (width - padding) / data.length - barSpacing,
9
+ x = d3.scale.linear()
10
+ .domain([0, data.length])
11
+ .range([0, width]),
12
+ y = d3.scale.linear()
13
+ .domain([0, d3.max(data, function(d) { return d.count; })])
14
+ .range([height, 0]),
15
+ xTimeScale = d3.time.scale()
16
+ .domain([
17
+ new Date(data[0].date),
18
+ d3.time.day.offset(new Date(data[data.length - 1].date), 1)
19
+ ])
20
+ .range([0, width]),
21
+ xAxis = d3.svg.axis()
22
+ .scale(xTimeScale)
23
+ .orient('bottom')
24
+ .ticks(d3.time.days, 1)
25
+ .tickFormat(d3.time.format('%Y-%m-%d')),
26
+ yAxis = d3.svg.axis()
27
+ .scale(y)
28
+ .orient('left')
29
+ .tickFormat(d3.format(',d')),
30
+ svg = d3.select(selector).append('svg')
31
+ .attr('height', height + padding)
32
+ .attr('width', width);
33
+
34
+ // bars
35
+ svg.selectAll('rect').data(data)
36
+ .enter()
37
+ .append('rect')
38
+ .attr({
39
+ 'class': 'bar',
40
+ 'x': function(d, i) { return x(i) + padding },
41
+ 'y': function(d) { return y(d.count) },
42
+ 'width': barWidth,
43
+ 'height': function(d) { return height - y(d.count); },
44
+ 'title': function(d) { return d.count + ' (' + d.date + ')'; },
45
+ 'data-toggle': 'tooltip'
46
+ });
47
+
48
+ $('#bar-chart [data-toggle=tooltip]').tooltip({ container: 'body' });
49
+
50
+ // show count inside bars if wide/high enough
51
+ if (barWidth > 20) {
52
+ svg.selectAll('text').data(data)
53
+ .enter()
54
+ .append('text')
55
+ .attr('x', function(d, i) { return x(i) + barWidth + padding; })
56
+ .attr('y', function(d, i) { return y(d.count); })
57
+ .attr('dx', -barWidth / 2)
58
+ .attr('dy', '1.2em')
59
+ .attr('text-anchor', 'middle')
60
+ .attr('class', 'value')
61
+ .text(function(d) { return height - y(d.count) > 15 ? d.count : '' });
62
+ }
63
+
64
+ // x-axis
65
+ svg.append('g')
66
+ .attr('class', 'xaxis axis')
67
+ .attr('transform', 'translate(' + padding + ', ' + height + ')')
68
+ .call(xAxis);
69
+
70
+ // y-axis
71
+ svg.append('g')
72
+ .attr('class', 'yaxis axis')
73
+ .attr('transform', 'translate(' + padding + ', 0)')
74
+ .call(yAxis)
75
+ .append('text')
76
+ .attr('transform', 'rotate(-90)')
77
+ .attr('y', 6)
78
+ .attr('dy', '.71em')
79
+ .style('text-anchor', 'end')
80
+ .text('Commits');
81
+
82
+ // date labels
83
+ svg.selectAll('.xaxis text')
84
+ .attr('transform', function(d) {
85
+ var h = this.getBBox().height;
86
+ return 'translate(' + h * -1 + ', ' + h + ') rotate(-30)';
87
+ });
88
+ };
89
+
90
+ return {
91
+ loadCommitsPerDay: loadCommitsPerDay
92
+ };
93
+ })();
94
+
95
+ $(document).initializeEach('table.sortable', function() {
96
+ $(this).stupidtable();
97
+ });
98
+
99
+ // for bootstrap:
100
+ $(document).initializeEach('[data-toggle=tooltip]', function() {
101
+ $(this).tooltip();
102
+ });
103
+
104
+ $(document).initializeEach('[data-toggle=popover]', function() {
105
+ $(this).popover({ html: true });
106
+ });
File without changes
Binary file
@@ -0,0 +1 @@
1
+ getbootstrap.com
@@ -0,0 +1,66 @@
1
+ # Contributing to Bootstrap
2
+
3
+ Looking to contribute something to Bootstrap? **Here's how you can help.**
4
+
5
+
6
+
7
+ ## Reporting issues
8
+
9
+ We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems that we can fix within the Bootstrap core. Please read the following guidelines before opening any issue.
10
+
11
+ 1. **Search for existing issues.** We get a lot of duplicate issues, and you'd help us out a lot by first checking if someone else has reported the same issue. Moreover, the issue may have already been resolved with a fix available.
12
+ 2. **Create an isolated and reproducible test case.** Be sure the problem exists in Bootstrap's code with a [reduced test case](http://css-tricks.com/reduced-test-cases/) that should be included in each bug report.
13
+ 3. **Include a live example.** Make use of jsFiddle or jsBin to share your isolated test cases.
14
+ 4. **Share as much information as possible.** Include operating system and version, browser and version, version of Bootstrap, customized or vanilla build, etc. where appropriate. Also include steps to reproduce the bug.
15
+
16
+
17
+
18
+ ## Key branches
19
+
20
+ - `master` is the latest, deployed version.
21
+ - `gh-pages` is the hosted docs (not to be used for pull requests).
22
+ - `*-wip` is the official work in progress branch for the next release.
23
+
24
+
25
+
26
+ ## Pull requests
27
+
28
+ - Try to submit pull requests against the latest `*-wip` branch for easier merging
29
+ - CSS changes must be done in .less files first, never just the compiled files
30
+ - If modifying the .less files, always recompile and commit the compiled files bootstrap.css and bootstrap.min.css
31
+ - Try not to pollute your pull request with unintended changes--keep them simple and small
32
+ - Try to share which browsers your code has been tested in before submitting a pull request
33
+
34
+
35
+
36
+ ## Coding standards
37
+
38
+ ### HTML
39
+
40
+ - Two spaces for indentation, never tabs
41
+ - Double quotes only, never single quotes
42
+ - Always use proper indentation
43
+ - Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags)
44
+
45
+ ### CSS
46
+
47
+ - Adhere to the [Recess CSS property order](http://markdotto.com/2011/11/29/css-property-order/)
48
+ - Multiple-line approach (one property and value per line)
49
+ - Always a space after a property's colon (.e.g, `display: block;` and not `display:block;`)
50
+ - End all lines with a semi-colon
51
+ - For multiple, comma-separated selectors, place each selector on its own line
52
+ - Attribute selectors, like `input[type="text"]` should always wrap the attribute's value in double quotes, for consistency and safety (see this [blog post on unquoted attribute values](http://mathiasbynens.be/notes/unquoted-attribute-values) that can lead to XSS attacks).
53
+
54
+ ### JS
55
+
56
+ - No semicolons
57
+ - Comma first
58
+ - 2 spaces (no tabs)
59
+ - strict mode
60
+ - "Attractive"
61
+
62
+
63
+
64
+ ## License
65
+
66
+ By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/twbs/bootstrap/blob/master/LICENSE
@@ -0,0 +1,195 @@
1
+ /* jshint node: true */
2
+
3
+ module.exports = function(grunt) {
4
+ "use strict";
5
+
6
+ // Project configuration.
7
+ grunt.initConfig({
8
+
9
+ // Metadata.
10
+ pkg: grunt.file.readJSON('package.json'),
11
+ banner: '/**\n' +
12
+ '* <%= pkg.name %>.js v<%= pkg.version %> by @fat and @mdo\n' +
13
+ '* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
14
+ '* <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
15
+ '*/\n',
16
+ jqueryCheck: 'if (!jQuery) { throw new Error(\"Bootstrap requires jQuery\") }\n\n',
17
+
18
+ // Task configuration.
19
+ clean: {
20
+ dist: ['dist']
21
+ },
22
+
23
+ jshint: {
24
+ options: {
25
+ jshintrc: 'js/.jshintrc'
26
+ },
27
+ gruntfile: {
28
+ src: 'Gruntfile.js'
29
+ },
30
+ src: {
31
+ src: ['js/*.js']
32
+ },
33
+ test: {
34
+ src: ['js/tests/unit/*.js']
35
+ }
36
+ },
37
+
38
+ concat: {
39
+ options: {
40
+ banner: '<%= banner %><%= jqueryCheck %>',
41
+ stripBanners: false
42
+ },
43
+ bootstrap: {
44
+ src: [
45
+ 'js/transition.js',
46
+ 'js/alert.js',
47
+ 'js/button.js',
48
+ 'js/carousel.js',
49
+ 'js/collapse.js',
50
+ 'js/dropdown.js',
51
+ 'js/modal.js',
52
+ 'js/tooltip.js',
53
+ 'js/popover.js',
54
+ 'js/scrollspy.js',
55
+ 'js/tab.js',
56
+ 'js/affix.js'
57
+ ],
58
+ dest: 'dist/js/<%= pkg.name %>.js'
59
+ }
60
+ },
61
+
62
+ uglify: {
63
+ options: {
64
+ banner: '<%= banner %>'
65
+ },
66
+ bootstrap: {
67
+ src: ['<%= concat.bootstrap.dest %>'],
68
+ dest: 'dist/js/<%= pkg.name %>.min.js'
69
+ }
70
+ },
71
+
72
+ recess: {
73
+ options: {
74
+ compile: true
75
+ },
76
+ bootstrap: {
77
+ src: ['less/bootstrap.less'],
78
+ dest: 'dist/css/<%= pkg.name %>.css'
79
+ },
80
+ min: {
81
+ options: {
82
+ compress: true
83
+ },
84
+ src: ['less/bootstrap.less'],
85
+ dest: 'dist/css/<%= pkg.name %>.min.css'
86
+ }
87
+ },
88
+
89
+ qunit: {
90
+ options: {
91
+ inject: 'js/tests/unit/phantom.js'
92
+ },
93
+ files: ['js/tests/*.html']
94
+ },
95
+
96
+ connect: {
97
+ server: {
98
+ options: {
99
+ port: 3000,
100
+ base: '.'
101
+ }
102
+ }
103
+ },
104
+
105
+ jekyll: {
106
+ docs: {}
107
+ },
108
+
109
+ validation: {
110
+ options: {
111
+ reset: true,
112
+ },
113
+ files: {
114
+ src: ["_gh_pages/**/*.html"]
115
+ }
116
+ },
117
+
118
+ watch: {
119
+ src: {
120
+ files: '<%= jshint.src.src %>',
121
+ tasks: ['jshint:src', 'qunit']
122
+ },
123
+ test: {
124
+ files: '<%= jshint.test.src %>',
125
+ tasks: ['jshint:test', 'qunit']
126
+ },
127
+ recess: {
128
+ files: 'less/*.less',
129
+ tasks: ['recess']
130
+ }
131
+ }
132
+ });
133
+
134
+
135
+ // These plugins provide necessary tasks.
136
+ grunt.loadNpmTasks('grunt-contrib-clean');
137
+ grunt.loadNpmTasks('grunt-contrib-concat');
138
+ grunt.loadNpmTasks('grunt-contrib-connect');
139
+ grunt.loadNpmTasks('grunt-contrib-jshint');
140
+ grunt.loadNpmTasks('grunt-contrib-qunit');
141
+ grunt.loadNpmTasks('grunt-contrib-uglify');
142
+ grunt.loadNpmTasks('grunt-contrib-watch');
143
+ grunt.loadNpmTasks('grunt-html-validation');
144
+ grunt.loadNpmTasks('grunt-jekyll');
145
+ grunt.loadNpmTasks('grunt-recess');
146
+ grunt.loadNpmTasks('browserstack-runner');
147
+
148
+
149
+ // Docs HTML validation task
150
+ grunt.registerTask('validate-docs', ['jekyll', 'validation']);
151
+
152
+ // Test task.
153
+ var testSubtasks = ['jshint', 'qunit', 'validate-docs'];
154
+ // Only run BrowserStack tests under Travis
155
+ if (process.env.TRAVIS) {
156
+ // Only run BrowserStack tests if this is a mainline commit in twbs/bootstrap, or you have your own BrowserStack key
157
+ if ((process.env.TRAVIS_REPO_SLUG === 'twbs/bootstrap' && process.env.TRAVIS_PULL_REQUEST === 'false') || process.env.TWBS_HAVE_OWN_BROWSERSTACK_KEY) {
158
+ testSubtasks.push('browserstack_runner');
159
+ }
160
+ }
161
+ grunt.registerTask('test', testSubtasks);
162
+
163
+ // JS distribution task.
164
+ grunt.registerTask('dist-js', ['concat', 'uglify']);
165
+
166
+ // CSS distribution task.
167
+ grunt.registerTask('dist-css', ['recess']);
168
+
169
+ // Full distribution task.
170
+ grunt.registerTask('dist', ['clean', 'dist-css', 'dist-js']);
171
+
172
+ // Default task.
173
+ grunt.registerTask('default', ['test', 'dist']);
174
+
175
+ // task for building customizer
176
+ grunt.registerTask('build-customizer', 'Add scripts/less files to customizer.', function () {
177
+ var fs = require('fs')
178
+
179
+ function getFiles(type) {
180
+ var files = {}
181
+ fs.readdirSync(type)
182
+ .filter(function (path) {
183
+ return new RegExp('\\.' + type + '$').test(path)
184
+ })
185
+ .forEach(function (path) {
186
+ return files[path] = fs.readFileSync(type + '/' + path, 'utf8')
187
+ })
188
+ return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'
189
+ }
190
+
191
+ var customize = fs.readFileSync('customize.html', 'utf-8')
192
+ var files = '<!-- generated -->\n<script id="files">\n' + getFiles('js') + getFiles('less') + '<\/script>\n<!-- /generated -->'
193
+ fs.writeFileSync('customize.html', customize.replace(/<!-- generated -->(.|[\n\r])*<!-- \/generated -->/, files))
194
+ });
195
+ };