monitoring-jekyll-theme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ <h3>Yellow Labs Tools</h3>
2
+ {% for org_hash in site.data.[include.site].[include.type] | sort %}
3
+ {% assign org = org_hash[1] %}
4
+ <div class="grid">
5
+ <div class="box date">
6
+ <span>Date</span>
7
+ <p>{{ org_hash[0] | date: "%d %b %y" }}</p>
8
+ </div>
9
+ <div class="box score">
10
+ <span>Time To First Byte</span>
11
+ {{ org.toolsResults.phantomas.metrics.timeToFirstByte | round }} <i>ms</i>
12
+ </div>
13
+ <div class="box score">
14
+ <span>html Size</span>
15
+ {{ org.toolsResults.phantomas.metrics.htmlSize | round }} <i>kb</i>
16
+ </div>
17
+ <div class="box score">
18
+ <span>js Size</span>
19
+ {{ org.toolsResults.phantomas.metrics.jsSize | round }} <i>kb</i>
20
+ </div>
21
+ <div class="box score">
22
+ <span>Time To First Css</span>
23
+ {{ org.toolsResults.phantomas.metrics.timeToFirstCss | round }} <i>ms</i>
24
+ </div>
25
+ <div class="box score">
26
+ <span>https Requests</span>
27
+ {{ org.toolsResults.phantomas.metrics.httpsRequests | round }}
28
+ </div>
29
+ <div class="box score">
30
+ <span>Not Found</span>
31
+ {{ org.toolsResults.phantomas.metrics.notFound | round }}
32
+ </div>
33
+ </div>
34
+ {% endfor %}
@@ -0,0 +1,19 @@
1
+ <html>
2
+
3
+ <head>
4
+ <link rel="stylesheet" href="/assets/css/styles.css">
5
+ </head>
6
+
7
+ <body>
8
+
9
+ <header class="wrapper">
10
+ <p><a href="/">Accueil</a></p>
11
+ <h1>Monitoring performance<br><small>{{ site.title }}</small></h1>
12
+ </header>
13
+
14
+ <div class="wrapper">
15
+ {{ content }}
16
+ </div>
17
+ </body>
18
+
19
+ </html>
@@ -0,0 +1,258 @@
1
+ # https://github.com/23maverick23/jekyll-humanize
2
+ module Jekyll
3
+
4
+ module Humanize
5
+ ##
6
+ # This is a port of the Django app `humanize` which adds a "human touch"
7
+ # to data. Given that Jekyll produces static sites, some of the original
8
+ # methods do not make logical sense (e.g. naturaltime).
9
+ #
10
+ # Source code can be viewed here:
11
+ # https://github.com/django/django
12
+ #
13
+ # Copyright (c) Django Software Foundation and individual contributors.
14
+ # All rights reserved.
15
+
16
+ ####################
17
+ # PUBLIC METHODS #
18
+ ####################
19
+
20
+ def ordinal(value, flag=nil)
21
+ ##
22
+ # Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd',
23
+ # 3 is '3rd', etc. Works for any integer.
24
+ #
25
+ # Usage:
26
+ # {{ somenum }} >>> 3
27
+ # {{ somenum | ordinal }} >>> '3rd'
28
+ # {{ somenum | ordinal: "super" }} >>> '3<sup>rd</sup>'
29
+
30
+ begin
31
+ value = value.to_i
32
+ flag.to_s.downcase!
33
+ rescue Exception => e
34
+ puts "#{e.class} #{e}"
35
+ return value
36
+ end
37
+
38
+ suffix = ""
39
+ suffixes = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"]
40
+ unless [11, 12, 13].include? value % 100 then
41
+ suffix = suffixes[value % 10]
42
+ else
43
+ suffix = suffixes[0]
44
+ end
45
+
46
+ unless flag and flag == "super"
47
+ return "#{value}%s" % suffix
48
+ else
49
+ return "#{value}<sup>%s</sup>" % suffix
50
+ end
51
+
52
+ end
53
+
54
+ def intcomma(value, delimiter=",")
55
+ ##
56
+ # Converts an integer to a string containing commas every three digits.
57
+ # For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
58
+ # Optionally supports a delimiter override for commas.
59
+ #
60
+ # Usage:
61
+ # {{ post.content | number_of_words }} >>> 12345
62
+ # {{ post.content | number_of_words | intcomma }} >>> '12,345'
63
+ # {{ post.content | number_of_words | intcomma: '.' }} >>> '12.345'
64
+
65
+ begin
66
+ orig = value.to_s
67
+ delimiter = delimiter.to_s
68
+ rescue Exception => e
69
+ puts "#{e.class} #{e}"
70
+ return value
71
+ end
72
+
73
+ copy = orig.strip
74
+ copy = orig.gsub(/^(-?\d+)(\d{3})/, "\\1#{delimiter}\\2")
75
+ orig == copy ? copy : intcomma(copy, delimiter)
76
+ end
77
+
78
+ INTWORD_HELPERS = [
79
+ [6, "million"],
80
+ [9, "billion"],
81
+ [12, "trillion"],
82
+ [15, "quadrillion"],
83
+ [18, "quintillion"],
84
+ [21, "sextillion"],
85
+ [24, "septillion"],
86
+ [27, "octillion"],
87
+ [30, "nonillion"],
88
+ [33, "decillion"],
89
+ [100, "googol"],
90
+ ]
91
+
92
+ def intword(value)
93
+ ##
94
+ # Converts a large integer to a friendly text representation. Works best
95
+ # for numbers over 1 million. For example, 1000000 becomes '1.0 million',
96
+ # 1200000 becomes '1.2 million' and 1200000000 becomes '1.2 billion'.
97
+ #
98
+ # Usage:
99
+ # {{ largenum }} >>> 1200000
100
+ # {{ largenum | intword }} >>> '1.2 million'
101
+
102
+ begin
103
+ value = value.to_i
104
+ rescue Exception => e
105
+ puts "#{e.class} #{e}"
106
+ return value
107
+ end
108
+
109
+ if value < 1000000
110
+ return value
111
+ end
112
+
113
+ for exponent, text in INTWORD_HELPERS
114
+ large_number = 10 ** exponent
115
+
116
+ if value < large_number * 1000
117
+ return "%#{value}.1f #{text}" % (value / large_number.to_f)
118
+ end
119
+
120
+ end
121
+
122
+ return value
123
+ end
124
+
125
+ def apnumber(value)
126
+ ##
127
+ # For numbers 0-9, returns the number spelled out. Otherwise, returns the
128
+ # number. This follows Associated Press style.
129
+ #
130
+ # Usage:
131
+ # {{ num }} >>> 6
132
+ # {{ num | apnumber }} >>> six
133
+
134
+ begin
135
+ value = value.to_i
136
+ rescue Exception => e
137
+ puts "#{e.class} #{e}"
138
+ return value
139
+ end
140
+
141
+ unless value >= 0 and value < 10 then
142
+ return value
143
+ else
144
+ return ["zero", "one", "two", "three", "four", "five", "six",
145
+ "seven", "eight", "nine"][value]
146
+ end
147
+
148
+ end
149
+
150
+ def naturalday(date)
151
+ ##
152
+ # For date values that are within a 9 day stretch from present day, this
153
+ # will attempt to return the string representation in the format of today,
154
+ # tomorrow, yesterday, "in # days" or "# days ago". Otherwise, returns a
155
+ # string formatted according to the "date_format" setting in your
156
+ # _config.yml file using strftime format (if not defined, it will default
157
+ # to "%m/%d/%Y").
158
+ #
159
+ # Usage:
160
+ # TODAY == 01/26/2014
161
+ # {{ post.updated }} >>> 01/25/2014
162
+ # {{ post.updated | naturalday }} >>> 'yesterday'
163
+ # {{ post.date }} >>> 01/19/2014
164
+ # {{ post.date | naturalday }} >>> 'seven days ago'
165
+
166
+ begin
167
+ site = @context.registers[:site]
168
+ date_format = site.config['humanize']['date_format']
169
+ date = time(date).to_date
170
+ rescue Exception => e
171
+ puts "#{e.class} #{e}"
172
+ return date
173
+ end
174
+
175
+ unless date_format then
176
+ date_format = "%m/%d/%Y"
177
+ end
178
+
179
+ today = time(Time.now).to_date
180
+ delta = (date - today).to_i
181
+
182
+ case delta
183
+ when 0
184
+ return "today"
185
+ when 1
186
+ return "tomorrow"
187
+ when 2..9
188
+ delta = apnumber(delta)
189
+ return "in #{delta} days"
190
+ when -1
191
+ return "yesterday"
192
+ when -9..-2
193
+ delta = apnumber(delta * -1)
194
+ return "#{delta} days ago"
195
+ else
196
+ return date.strftime("#{date_format}")
197
+ end
198
+
199
+ end
200
+
201
+ def filesize(value)
202
+ ##
203
+ # For filesize values in bytes, returns the number rounded to 3
204
+ # decimal places with the correct suffix.
205
+ #
206
+ # Usage:
207
+ # {{ bytes }} >>> 123456789
208
+ # {{ bytes | filesize }} >>> 117.738 MB
209
+ filesize_tb = 1099511627776.0
210
+ filesize_gb = 1073741824.0
211
+ filesize_mb = 1048576.0
212
+ filesize_kb = 1024.0
213
+
214
+ begin
215
+ value = value.to_f
216
+ rescue Exception => e
217
+ puts "#{e.class} #{e}"
218
+ return value
219
+ end
220
+
221
+ if value >= filesize_tb
222
+ return "%s TB" % (value / filesize_tb).to_f.round(3)
223
+ elsif value >= filesize_gb
224
+ return "%s GB" % (value / filesize_gb).to_f.round(3)
225
+ elsif value >= filesize_mb
226
+ return "%s MB" % (value / filesize_mb).to_f.round(3)
227
+ elsif value >= filesize_kb
228
+ return "%s KB" % (value / filesize_kb).to_f.round(0)
229
+ elsif value == 1
230
+ return "1 byte"
231
+ else
232
+ return "%s bytes" % value.to_f.round(0)
233
+ end
234
+
235
+ end
236
+
237
+ #####################
238
+ # PRIVATE METHODS #
239
+ #####################
240
+
241
+ private
242
+ def time(input)
243
+ case input
244
+ when Time
245
+ input
246
+ when String
247
+ Time.parse(input)
248
+ else
249
+ Jekyll.logger.error "Invalid Date:", "'#{input}' not valid datetime."
250
+ exit(1)
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end
257
+
258
+ Liquid::Template.register_filter(Jekyll::Humanize)