iodine 0.7.60 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +15 -0
  3. data/.rspec +1 -0
  4. data/.yardopts +1 -3
  5. data/CHANGELOG.md +132 -12
  6. data/Gemfile +5 -7
  7. data/LICENSE.txt +1 -1
  8. data/README.md +147 -671
  9. data/Rakefile +9 -16
  10. data/examples/chatroom.nru +9 -0
  11. data/examples/client +74 -0
  12. data/examples/config-hello.nru +9 -0
  13. data/examples/config-hello.ru +11 -0
  14. data/examples/config-hijack.ru +13 -0
  15. data/examples/config-shootout.ru +43 -0
  16. data/examples/config.nru +120 -0
  17. data/examples/config.rb +37 -0
  18. data/examples/config.ru +42 -53
  19. data/examples/fake +24 -0
  20. data/examples/hello_neorack +137 -0
  21. data/examples/routes.nru +29 -0
  22. data/examples/routes.ru +42 -0
  23. data/exe/iodine +218 -258
  24. data/ext/iodine/extconf.rb +27 -100
  25. data/ext/iodine/fio-stl.h +128336 -0
  26. data/ext/iodine/fio-stl.md +26396 -0
  27. data/ext/iodine/iodine.c +213 -1393
  28. data/ext/iodine/iodine.h +250 -55
  29. data/ext/iodine/iodine_arg_helper.h +329 -0
  30. data/ext/iodine/iodine_caller.h +234 -25
  31. data/ext/iodine/iodine_cli.h +434 -0
  32. data/ext/iodine/iodine_compression.h +312 -0
  33. data/ext/iodine/iodine_connection.h +3484 -34
  34. data/ext/iodine/iodine_core.h +363 -0
  35. data/ext/iodine/iodine_crypto.h +1441 -0
  36. data/ext/iodine/iodine_defer.h +225 -4
  37. data/ext/iodine/iodine_json.h +738 -4
  38. data/ext/iodine/iodine_listener.h +263 -0
  39. data/ext/iodine/iodine_log.h +297 -0
  40. data/ext/iodine/iodine_minimap.h +543 -0
  41. data/ext/iodine/iodine_mustache.h +461 -4
  42. data/ext/iodine/iodine_pubsub_eng.h +729 -0
  43. data/ext/iodine/iodine_pubsub_history.h +547 -0
  44. data/ext/iodine/iodine_pubsub_msg.h +228 -0
  45. data/ext/iodine/iodine_redis.h +322 -0
  46. data/ext/iodine/iodine_store.h +418 -16
  47. data/ext/iodine/iodine_threads.h +279 -0
  48. data/ext/iodine/iodine_tls.h +515 -6
  49. data/ext/iodine/iodine_utils.h +923 -0
  50. data/iodine.gemspec +37 -42
  51. data/lib/iodine/benchmark.rb +1690 -0
  52. data/lib/iodine/documentation.rb +3085 -0
  53. data/lib/iodine/version.rb +17 -1
  54. data/lib/iodine.rb +54 -255
  55. data/logo.svg +36 -0
  56. data/mustache.md +55 -0
  57. data/sig/iodine.rbs +4 -0
  58. metadata +58 -184
  59. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  60. data/.github/workflows/ruby.yml +0 -42
  61. data/.gitignore +0 -21
  62. data/LIMITS.md +0 -41
  63. data/SPEC-PubSub-Draft.md +0 -159
  64. data/SPEC-WebSocket-Draft.md +0 -239
  65. data/bin/console +0 -22
  66. data/bin/info.md +0 -353
  67. data/bin/mustache_bench.rb +0 -100
  68. data/bin/poc/Gemfile.lock +0 -23
  69. data/bin/poc/README.md +0 -37
  70. data/bin/poc/config.ru +0 -66
  71. data/bin/poc/gemfile +0 -1
  72. data/bin/poc/www/index.html +0 -57
  73. data/examples/async_task.ru +0 -92
  74. data/examples/bates/README.md +0 -3
  75. data/examples/bates/config.ru +0 -342
  76. data/examples/bates/david+bold.pdf +0 -0
  77. data/examples/bates/public/drop-pdf.png +0 -0
  78. data/examples/bates/public/index.html +0 -600
  79. data/examples/echo.ru +0 -59
  80. data/examples/etag.ru +0 -16
  81. data/examples/hello.ru +0 -29
  82. data/examples/pubsub_engine.ru +0 -81
  83. data/examples/rack3.ru +0 -12
  84. data/examples/redis.ru +0 -70
  85. data/examples/shootout.ru +0 -73
  86. data/examples/sub-protocols.ru +0 -90
  87. data/examples/tcp_client.rb +0 -66
  88. data/examples/x-sendfile.ru +0 -14
  89. data/ext/iodine/fio.c +0 -11995
  90. data/ext/iodine/fio.h +0 -6371
  91. data/ext/iodine/fio_cli.c +0 -431
  92. data/ext/iodine/fio_cli.h +0 -189
  93. data/ext/iodine/fio_json_parser.h +0 -688
  94. data/ext/iodine/fio_siphash.c +0 -157
  95. data/ext/iodine/fio_siphash.h +0 -37
  96. data/ext/iodine/fio_tls.h +0 -129
  97. data/ext/iodine/fio_tls_missing.c +0 -649
  98. data/ext/iodine/fio_tls_openssl.c +0 -1106
  99. data/ext/iodine/fio_tmpfile.h +0 -50
  100. data/ext/iodine/fiobj.h +0 -44
  101. data/ext/iodine/fiobj4fio.h +0 -21
  102. data/ext/iodine/fiobj_ary.c +0 -333
  103. data/ext/iodine/fiobj_ary.h +0 -139
  104. data/ext/iodine/fiobj_data.c +0 -1187
  105. data/ext/iodine/fiobj_data.h +0 -167
  106. data/ext/iodine/fiobj_hash.c +0 -409
  107. data/ext/iodine/fiobj_hash.h +0 -176
  108. data/ext/iodine/fiobj_json.c +0 -622
  109. data/ext/iodine/fiobj_json.h +0 -68
  110. data/ext/iodine/fiobj_mem.h +0 -71
  111. data/ext/iodine/fiobj_mustache.c +0 -317
  112. data/ext/iodine/fiobj_mustache.h +0 -62
  113. data/ext/iodine/fiobj_numbers.c +0 -344
  114. data/ext/iodine/fiobj_numbers.h +0 -127
  115. data/ext/iodine/fiobj_str.c +0 -433
  116. data/ext/iodine/fiobj_str.h +0 -172
  117. data/ext/iodine/fiobject.c +0 -620
  118. data/ext/iodine/fiobject.h +0 -655
  119. data/ext/iodine/hpack.h +0 -1923
  120. data/ext/iodine/http.c +0 -2743
  121. data/ext/iodine/http.h +0 -1002
  122. data/ext/iodine/http1.c +0 -910
  123. data/ext/iodine/http1.h +0 -29
  124. data/ext/iodine/http1_parser.h +0 -878
  125. data/ext/iodine/http_internal.c +0 -1279
  126. data/ext/iodine/http_internal.h +0 -237
  127. data/ext/iodine/http_mime_parser.h +0 -350
  128. data/ext/iodine/iodine_caller.c +0 -230
  129. data/ext/iodine/iodine_connection.c +0 -941
  130. data/ext/iodine/iodine_defer.c +0 -420
  131. data/ext/iodine/iodine_fiobj2rb.h +0 -120
  132. data/ext/iodine/iodine_helpers.c +0 -282
  133. data/ext/iodine/iodine_helpers.h +0 -12
  134. data/ext/iodine/iodine_http.c +0 -1181
  135. data/ext/iodine/iodine_http.h +0 -23
  136. data/ext/iodine/iodine_json.c +0 -302
  137. data/ext/iodine/iodine_mustache.c +0 -567
  138. data/ext/iodine/iodine_pubsub.c +0 -580
  139. data/ext/iodine/iodine_pubsub.h +0 -26
  140. data/ext/iodine/iodine_rack_io.c +0 -273
  141. data/ext/iodine/iodine_rack_io.h +0 -20
  142. data/ext/iodine/iodine_store.c +0 -148
  143. data/ext/iodine/iodine_tcp.c +0 -346
  144. data/ext/iodine/iodine_tcp.h +0 -13
  145. data/ext/iodine/iodine_tls.c +0 -261
  146. data/ext/iodine/mustache_parser.h +0 -1546
  147. data/ext/iodine/redis_engine.c +0 -957
  148. data/ext/iodine/redis_engine.h +0 -79
  149. data/ext/iodine/resp_parser.h +0 -317
  150. data/ext/iodine/websocket_parser.h +0 -506
  151. data/ext/iodine/websockets.c +0 -743
  152. data/ext/iodine/websockets.h +0 -185
  153. data/lib/iodine/connection.rb +0 -61
  154. data/lib/iodine/json.rb +0 -42
  155. data/lib/iodine/mustache.rb +0 -113
  156. data/lib/iodine/pubsub.rb +0 -55
  157. data/lib/iodine/rack_utils.rb +0 -43
  158. data/lib/iodine/tls.rb +0 -16
  159. data/lib/rack/handler/iodine.rb +0 -33
  160. data/logo.png +0 -0
@@ -1,600 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en"><head>
3
- <title>Bates Numbering for Court</title>
4
- <meta charset='utf-8'>
5
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no, minimal-ui=yes">
6
- <style>
7
- html, body {
8
- height: 100%; width: 100%;
9
- padding: 0; margin: 0;
10
- color: #111;
11
- background-color: #99A3CE;
12
- }
13
-
14
- h2, h3 {
15
- font-size: 1.2em;
16
- background-color: #44518E;
17
- color: #C6CCE7;
18
- }
19
- h2 a, h3 a
20
- {
21
- color: inherit;
22
- text-decoration: none;
23
- }
24
- h2 a:hover, h3 a:hover
25
- {
26
- color: #00f;
27
- }
28
-
29
- h1 {
30
- font-size: 1.5em;
31
- text-align: center;
32
- background-color: #1B2864;
33
- color: #99A3CE;
34
- margin:0; padding: 0.5em;
35
- }
36
- h2 {
37
- border-radius: 0.5em;
38
- text-align: center;
39
- }
40
- h3 {
41
- text-align: left;
42
- }
43
- .hide {
44
- display: none !important;
45
- }
46
- span.en {
47
- direction: ltr;
48
- display: inline-block;
49
- text-align: left;
50
- width: auto;
51
- }
52
- #notice
53
- {
54
- z-index: 99999;
55
- position: absolute;
56
- top: 0; left: 0;
57
- background-color: rgba(0, 0, 0, 0.75);
58
- box-sizing: border-box;
59
- padding: 1em 0;
60
- text-align: center;
61
- height: 100px;
62
- width: 100%;
63
- overflow-y: auto;
64
- color: #fff; font-weight: bold;
65
- transition:All 0.25s ease;
66
- -webkit-transition:All 0.25s ease;
67
- -moz-transition:All 0.25s ease;
68
- -o-transition:All 0.25s ease;
69
- -ms-transition:All 0.25s ease;
70
- transform-origin: 0 50%;
71
- -webkit-transform-origin: 50% 0; /* Chrome, Safari, Opera */
72
- -ms-transform-origin: 50% 0; /* IE 9 */
73
- -moz-transform-origin: 50% 0;
74
- -o-transform-origin: 50% 0;
75
- transform: scale(1, 1);
76
- -webkit-transform: scale(1, 1);
77
- -moz-transform: scale(1, 1);
78
- -o-transform: scale(1, 1);
79
- -ms-transform: scale(1, 1);
80
- }
81
- #notice.hidden
82
- {
83
- transform: scale(1, 0);
84
- -webkit-transform: scale(1, 0);
85
- -moz-transform: scale(1, 0);
86
- -o-transform: scale(1, 0);
87
- -ms-transform: scale(1, 0);
88
- }
89
- #notice .notice_close
90
- {
91
- display:block;
92
- position: absolute;
93
- top:0; left:0;
94
- padding:0.5em;
95
- height:100%;
96
- width:5em;
97
- text-align:left;
98
- cursor: pointer;
99
- border-right:1px solid #eee;
100
- color: #ccc;
101
- }
102
- #notice .notice_close:hover
103
- {
104
- color: #eee;
105
- background-color: rgba(255, 255, 255, 0.25);
106
- }
107
-
108
- #content {
109
- background-color: #fff;
110
- color: #111;
111
- min-height: 100%;
112
- padding: 4em 1.5em;
113
- margin: 0 1em;
114
- overflow-x: hidden;
115
- box-sizing: border-box;
116
- }
117
- #content h1, #content h2, #content h3 {
118
- background-color: #1B2864;
119
- color: #99A3CE;
120
- padding: 0.2em 1em;
121
- margin: 0.2em 0;
122
- }
123
- #content h1 {
124
- padding: 0.5em;
125
- margin: 0;
126
- }
127
- #content p {
128
- padding: 0.5em;
129
- margin: 0;
130
- }
131
- #content a {
132
- color: #0000aa;
133
- text-decoration: none;
134
- }
135
- #content a:hover {
136
- color: blue;
137
- text-decoration: underline;
138
- background: white;
139
- position: relative;
140
- top: 1px;
141
- left: 2px;
142
- }
143
- #content h1 a, #content h2 a, #content h3 a, #content table th a {
144
- color: #aaaaff;
145
- }
146
- #content h1 a:hover, #content h2 a:hover, #content h3 a:hover, #content table th a:hover {
147
- background: inherit;
148
- color: #ddddff;
149
- }
150
- #content #notice {
151
- background: #ffaadd;
152
- color: #551111;
153
- margin: 0.3em 15%;
154
- padding: 1em 0.5em;
155
- text-align: center;
156
- border-radius: 1em;
157
- font-weight: bold;
158
- font-size: 1.1em;
159
- }
160
-
161
- .desc, form {
162
- text-align: justify;
163
- display: block;
164
- margin: 0.5em 15%; padding: 0 0 0.5em 0;
165
- background: #eeeefa;
166
- color: #111111;
167
- border-radius: 1em;
168
- }
169
- .with_border
170
- {
171
- border: 1px solid #aab;
172
- }
173
- .desc p, form p {
174
- padding: 0.2em;
175
- margin: 0.5em 0;
176
- }
177
- form input[type='submit'] {
178
- margin: 0.5em 20%;
179
- width: 60%;
180
- color: #000033;
181
- background: #eeeeff;
182
- }
183
- form table {
184
- width: 100%;
185
- table-layout: fixed;
186
- border-collapse: collapse;
187
- }
188
- form table th {
189
- background: #bbb;
190
- color: #111111;
191
- }
192
- form table td {
193
- width: 2%;
194
- border-collapse: collapse;
195
- border-top: #bbbbcc dotted 1px;
196
- border-bottom: #bbbbcc dotted 1px;
197
- padding: 1px 2px;
198
- }
199
- form table tr {
200
- border-collapse: collapse;
201
- }
202
- form table .en {
203
- direction: ltr;
204
- }
205
- form table input, form table select {
206
- width: 100%;
207
- margin: 0.5em 0;
208
- padding: 0;
209
- color: #000033;
210
- background: #eeeeff;
211
- }
212
- form table .no_resize input, form table .no_resize select {
213
- width: auto;
214
- margin: 0.5em 0;
215
- padding: inherit;
216
- }
217
- form .field {
218
- width: 100%;
219
- display: block;
220
- text-align: justify;
221
- padding: 0.5em 0;
222
- margin: 0;
223
- margin-bottom: 0;
224
- vertical-align: top;
225
- border-collapse: collapse;
226
- border-top: #bbbbcc dotted 1px;
227
- border-bottom: #bbbbcc dotted 1px;
228
- }
229
- form .field label {
230
- width: 34%;
231
- margin: 0 2%;
232
- padding: 0;
233
- display: inline-block;
234
- vertical-align: top;
235
- }
236
- form .field input {
237
- width: 60%;
238
- margin: 0;
239
- padding: 0;
240
- display: inline-block;
241
- vertical-align: top;
242
- color: #000033;
243
- background: #eeeeff;
244
- }
245
- form .field select {
246
- width: 60%;
247
- margin: 0;
248
- padding: 0;
249
- }
250
- form .field .no_resize input, form .field .no_resize select {
251
- width: auto;
252
- margin: inherit;
253
- padding: inherit;
254
- color: #000033;
255
- background: #eeeeff;
256
- }
257
- form .field textarea {
258
- width: 98%;
259
- padding: 0;
260
- margin: 0;
261
- height: 5em;
262
- display: block;
263
- color: #000033;
264
- background: #eeeeff;
265
- }
266
- form .en input, form .en textarea {
267
- text-align: left;
268
- direction: ltr;
269
- }
270
-
271
- table.one_liners {
272
- table-layout: fixed !important;
273
- max-width: 100% !important;
274
- width: 100% !important;
275
- text-overflow: ellipsis;
276
- overflow: none;
277
- }
278
- table.one_liners td, table.one_liners th {
279
- width: inherit;
280
- max-width: 10%;
281
- white-space: nowrap;
282
- text-overflow: ellipsis;
283
- }
284
-
285
- h1#dropzone {
286
- font-size: 2em;
287
- text-align: center;
288
- background-color: #44518E;
289
- color: #C6CCE7;
290
- padding: 0.5em 0;
291
- background-image: url(/drop-pdf.png);
292
- background-repeat: no-repeat;
293
- background-position: 10% center;
294
- background-size: auto 100%;
295
- border-radius: 0.5em 0.5em 0 0;
296
- }
297
-
298
- ul.bates_file_table_list, ol.bates_file_table_list {
299
- display: block;
300
- margin: 0;
301
- padding: 0;
302
- list-style-position: inside;
303
- width: 100%;
304
- }
305
- ul.bates_file_table_list li, ol.bates_file_table_list li {
306
- border-top: 1px dotted #111111;
307
- border-bottom: 1px dotted #111111;
308
- border-collapse: collapse;
309
- }
310
- ul.bates_file_table_list li div, ol.bates_file_table_list li div {
311
- display: inline-block;
312
- width: 28%;
313
- }
314
- ul.bates_file_table_list input, ol.bates_file_table_list input {
315
- width: 90%;
316
- color: #000033;
317
- background: #eeeeff;
318
- }
319
- ul.bates_file_table_list {
320
- list-style-type: circle;
321
- }
322
- ul.bates_file_table_list li:first-child {
323
- background: #aab;
324
- color: #111111;
325
- }
326
- input[type=checkbox]:checked#bates_first_pdf_is_cover ~ ol.bates_file_table_list li:first-child {
327
- background: #bbc;
328
- color: #551111;
329
- }
330
- input[type=checkbox]
331
- {
332
- width: auto;
333
- display: inline;
334
- }
335
- #file_remover {
336
- float: left;
337
- }
338
-
339
- /* RESPONSIVE RELATED */
340
- @media screen and (max-width: 46em) {
341
- /* STYLING CONTENT (none at the moment)*/
342
- /* line 800, /Users/2Be/Ruby/combine_pdf_demo/app/assets/stylesheets/welcome.css.scss */
343
- body, html {
344
- height: auto;
345
- }
346
-
347
- /* line 803, /Users/2Be/Ruby/combine_pdf_demo/app/assets/stylesheets/welcome.css.scss */
348
- #content {
349
- padding: 3em 0;
350
- margin: 0;
351
- }
352
- #content #notice {
353
- margin: 0.2em 1em;
354
- }
355
- /* line 814, /Users/2Be/Ruby/combine_pdf_demo/app/assets/stylesheets/welcome.css.scss */
356
- #content .hide_when_small {
357
- display: none;
358
- }
359
- form, .desc {
360
- margin: 0.3em 1em;
361
- }
362
- }
363
- </style>
364
- <script>
365
- function show_notice() { document.getElementById("notice").classList.remove('hidden'); }
366
- function hide_notice() { document.getElementById("notice").classList.add('hidden'); }
367
- </script>
368
- </head><body>
369
- <h1>Bates Numbering - PDF file merge and number</h1>
370
- <div id="notice" class="hidden"><a class='notice_close'onclick='hide_notice()'>X</a><div id="notice_text"></div></div>
371
- <div id="contents">
372
- <ol class='bates_file_table_list' id='demo' style='display:none;'>
373
- <li id='file_NUM'>
374
- <div>
375
- <input id="file_NUM_name" name="file[NUM][name]" readonly="readonly" type="text" value="FILE_NAME">
376
- <input id="file_NUM_data" name="file[NUM][data]" type="hidden" value="NUM">
377
- </div>
378
- <div>
379
- <input id="file_NUM_date" name="file[NUM][date]" type="text" value="DATE">
380
- </div><div>
381
- <input id="file_NUM_title" name="file[NUM][title]" type="text" value="TITLE">
382
- </div>
383
- |||
384
- <a href="#" class="file_remover" onclick='this.parentNode.parentNode.removeChild(this.parentNode); return false;'>[x]</a>
385
- </li>
386
- </ol>
387
- <form accept-charset="UTF-8" enctype="multipart/form-data" method="post" onsubmit="onSubmit()">
388
- <h1 id='dropzone'>Drag PDF files here</h1>
389
- <p>
390
- <ul class='bates_file_table_list'>
391
- <li>
392
- <div>File Name</div>
393
- <div>Date</div>
394
- <div>Title</div>
395
- </li>
396
- </ul>
397
- <input checked="checked" id="bates_first_pdf_is_cover" name="bates[first_pdf_is_cover]" type="checkbox" value="true">
398
- <label for="bates_first_pdf_is_cover">Place the first PDF file before the Index page.</label>
399
- <ol class='bates_file_table_list' id='file_list'></ol>
400
- <input type="submit" value="Submit">
401
- </p>
402
- <h3>Settings</h3>
403
- <table>
404
- <tr><td>Output file name:</td><td><input type='text' id="output_filename" name='bates[output]' value="combined"></td></tr><tr><td>First page number:</td><td><input type='number' name='bates[first_page_number]' value="1">
405
- </td></tr><tr><td>First index number:</td><td><input type='number' name='bates[first_index_number]' value="1">
406
- </td></tr><tr><td>Numbering:</td><td><select id='numbering' name='bates[numbering]'>
407
- <option value='0'>Center</option>
408
- <option value='1'>Left</option>
409
- <option value='2'>Right</option>
410
- <option value='3'>None</option>
411
- </select>
412
- </td></tr><tr><td><input checked="checked" id="bates_should_index_files" name="bates[should_index]" type="checkbox" value="true"><label for='bates_should_index_files'>Index Files?</label></td><td><label for='bates_should_index_files'>un-check to avoid an index and title pages.</label>
413
- </td></tr><tr><td><input id="bates_skip_cover" name="bates[skip_cover]" type="checkbox" value="true"><label for='bates_skip_cover'>Skip Cover?</label></td><td><label for='bates_skip_cover'>check to skip numbering the cover page.</label>
414
- </td></tr><tr><td>Language:</td><td><select id='dir' name='bates[dir]'>
415
- <option value='rtl'>עברית</option>
416
- <option value='ltr'>English</option>
417
- </select>
418
- </td></tr><tr><td>Index Title:</td><td>
419
- <input type='text' id='bates_index_title' name='bates[index_title]' value="Index">
420
- </td></tr><tr><td>"Number" Header:</td><td>
421
- <input type='text' id='bates_number_header' name='bates[number_header]' value="#">
422
- </td></tr><tr><td>"Date" Header (Leave empty to ignore):</td><td>
423
- <input type='text' id='bates_date_header' name='bates[date_header]' value="Date">
424
- </td></tr><tr><td>"Title" Header:</td><td>
425
- <input type='text' id='bates_title_header' name='bates[title_header]' value="Title">
426
- </td></tr><tr><td> "Page Number" Header:</td><td>
427
- <input type='text' id='bates_page_header' name='bates[page_header]' value="Page">
428
- </td></tr><tr><td>Cover Page Title:</td><td>
429
- <input type='text' id='bates_title_type' name='bates[title_type]' value="Exhibit">
430
- <input type="submit" value="Submit">
431
- </form>
432
- </div>
433
- <script>
434
- function onSubmit()
435
- {
436
- return true;
437
- }
438
- file_i=0
439
- files_read = 0
440
-
441
- template = document.getElementById('demo').innerHTML
442
-
443
- function transform_file(file)
444
- {
445
- // Get Time and Title if the name matches standard naming
446
- obj_date_string = file.name.match("^[0-9\\-–]*") + ""
447
- if(obj_date_string.length == 8) {
448
- obj_date = obj_date_string.substr(6,2) + "." + obj_date_string.substr(4,2) + "." + obj_date_string.substr(0,4)
449
- obj_description = file.name.substring(9, file.name.toLowerCase().search("\.pdf") )
450
- } else if(obj_date_string.length == 10 && obj_date_string[4] == '-' && obj_date_string[7] == '-') {
451
- obj_date = obj_date_string.substr(8,2) + "." + obj_date_string.substr(5,2) + "." + obj_date_string.substr(0,4)
452
- obj_description = file.name.substring(11, file.name.toLowerCase().search("\.pdf") )
453
- } else {
454
- obj_date = ""
455
- obj_description = file.name.substring(0, file.name.toLowerCase().search("\.pdf") )
456
- }
457
-
458
- // copy template and adjust details
459
-
460
- document.getElementById('file_list').innerHTML += template.replace(RegExp("NUM", "g"), "" + file_i).replace(RegExp("FILE_NAME", "g"), file.name).replace(RegExp("DATE", "g"), obj_date).replace(RegExp("TITLE", "g"), obj_description)
461
-
462
- // set reader for file
463
- reader = new FileReader();
464
- reader.futureObject = document.getElementById("file_" + file_i + "_data")
465
-
466
- file_i += 1;
467
-
468
- reader.onloadend = function(e)
469
- {
470
- //var id = this.futureObject.value
471
- console.log("adding result to: " + this.futureObject.id )
472
- document.getElementById(this.futureObject.id).value = e.target.result
473
- files_read +=1
474
- }
475
-
476
- //reader.readAsText(file)
477
- reader.readAsDataURL(file)
478
- true
479
- }
480
-
481
- // make drop_zone droppable and set callbacks
482
- var dropzone = document.getElementById('dropzone')
483
-
484
- dropzone.ondragend = function (event) {event.stopPropagation();return false; };
485
- dropzone.ondragover = function (event) {event.stopPropagation();return false; };
486
- dropzone.ondragenter = function (event) {event.stopPropagation();return false; };
487
-
488
- dropzone.ondrop = function(event) {
489
- event.preventDefault()
490
- event.stopPropagation();
491
- var files = event.dataTransfer.files; // FileList object.
492
- i = 0
493
- while(files[i])
494
- {
495
- console.log('transforming:' + files[i] + ' name: ' + files[i].name.toLowerCase())
496
- if( files[i].name.toLowerCase().search("\.pdf") != -1) transform_file(files[i])
497
- i++
498
- }
499
-
500
- set_list_sotrable()
501
- return false;
502
- }
503
-
504
- // make drag-drop and sortable list from file_list
505
- var Dragged_id = ''
506
-
507
- function start_drag_list_item(e) {
508
- Dragged_id = this.id
509
- e.dataTransfer.setData('text/plain', this.id)
510
- this.style.opacity = '0.3'
511
- }
512
- function end_drag_list_item(e) {
513
- this.style.opacity = '1'
514
- Dragged_id = ''
515
- }
516
- function enter_drag_list_item(e) {
517
- if(Dragged_id == '') return false;
518
- if(this.id == Dragged_id) return false; //this.style.opacity = '0.7'
519
- this.parentNode.insertBefore(this.parentNode.removeChild(document.getElementById(Dragged_id)), this);
520
- }
521
- function leave_drag_list_item(e) {
522
- if(Dragged_id == '') return false;
523
- if(this.id != Dragged_id) this.style.opacity = '1'
524
- }
525
- function drop_list_item(e)
526
- {
527
- e.stopPropagation()
528
- e.preventDefault()
529
- alert('move ' + Dragged_id + ' before ' + this.id)
530
- if (this.id == Dragged_id) return false;
531
- }
532
- function set_list_sotrable()
533
- {
534
- all_list_items = document.querySelectorAll('#file_list li');
535
- for(i=0; i < all_list_items.length; i++)
536
- {
537
- all_list_items[i].setAttribute("draggable","true");
538
- all_list_items[i].ondragstart = start_drag_list_item
539
- all_list_items[i].ondragenter = enter_drag_list_item
540
- all_list_items[i].ondragleave = leave_drag_list_item
541
- all_list_items[i].ondragend = end_drag_list_item
542
- all_list_items[i].ondrop = drop_list_item
543
- }
544
- }
545
-
546
- function get_today_as_str(){
547
- const n = new Date();
548
- return (n.getUTCFullYear().toString() + (n.getUTCMonth() < 10 ? ("0" + n.getUTCMonth().toString()) : n.getUTCMonth().toString()) + (n.getUTCMonth() < 10 ? ("0" + n.getUTCDate().toString()) : n.getUTCDate().toString()));
549
- }
550
-
551
- // set some initial values
552
- function set_common_values(o){
553
- for (let [key, value] of Object.entries(o)) {
554
- console.log(key, value);
555
- var tmp = document.getElementById(key);
556
- if(tmp){
557
- if(tmp.value)
558
- tmp.value = value;
559
- else
560
- tmp.innerHTML = value;
561
- }
562
- }
563
- }
564
- function set_en_values(){
565
-
566
- set_common_values({
567
- output_filename: get_today_as_str() + " name",
568
- bates_index_title: "Index",
569
- bates_number_header: "Ex.",
570
- bates_date_header: "Date",
571
- bates_title_header: "Title",
572
- bates_page_header: "Page",
573
- bates_title_type: "Exhibit",
574
- });
575
- }
576
- function set_he_values(){
577
- set_common_values({
578
- output_filename: get_today_as_str() + " שם",
579
- bates_index_title: "תוכן עניינים",
580
- bates_number_header: "נספח",
581
- bates_date_header: "תאריך",
582
- bates_title_header: "כותרת",
583
- bates_page_header: "עמוד",
584
- bates_title_type: "נספח",
585
- });
586
- }
587
-
588
- function update_defaults(e) {
589
- if(e.target.value == 'ltr') set_en_values();
590
- else set_he_values();
591
- }
592
-
593
- function init_page(e){
594
- set_he_values();
595
- var tmp = document.getElementById("dir");
596
- tmp.onchange = update_defaults;
597
- }
598
- init_page();
599
- </script>
600
- </body></html>
data/examples/echo.ru DELETED
@@ -1,59 +0,0 @@
1
- # This is a Websocket echo application.
2
- #
3
- # Running this application from the command line is easy with:
4
- #
5
- # iodine echo.ru
6
- #
7
- # Or, in single thread and single process:
8
- #
9
- # iodine -t 1 -w 1 echo.ru
10
- #
11
- # Benchmark with `ab` or `wrk` (a 5 seconds benchmark with 2000 concurrent clients):
12
- #
13
- # ab -c 2000 -t 5 -n 1000000 -k http://127.0.0.1:3000/
14
- # wrk -c2000 -d5 -t12 http://localhost:3000/
15
- #
16
- # Test websocket echo using the browser. For example:
17
- # ws = new WebSocket("ws://localhost:3000"); ws.onmessage = function(e) {console.log("Got message!"); console.log(e.data);}; ws.onclose = function(e) {console.log("closed")}; ws.onopen = function(e) {ws.send("hi");};
18
-
19
-
20
- # A simple router - Checks for Websocket Upgrade and answers HTTP.
21
- module MyHTTPRouter
22
- # This is the HTTP response object according to the Rack specification.
23
- HTTP_RESPONSE = [200, { 'Content-Type' => 'text/html',
24
- 'Content-Length' => '32' },
25
- ['Please connect using websockets.']]
26
-
27
- WS_RESPONSE = [0, {}, []].freeze
28
-
29
- # this is function will be called by the Rack server (iodine) for every request.
30
- def self.call env
31
- # check if this is an upgrade request.
32
- if(env['rack.upgrade?'.freeze] == :websocket)
33
- env['rack.upgrade'.freeze] = WebsocketEcho
34
- return WS_RESPONSE
35
- end
36
- # simply return the RESPONSE object, no matter what request was received.
37
- HTTP_RESPONSE
38
- end
39
- end
40
-
41
- # A simple Websocket Callback Object.
42
- module WebsocketEcho
43
- # seng a message to new clients.
44
- def on_open client
45
- client.write "Welcome to our echo service!"
46
- end
47
- # send a message, letting the client know the server is suggunt down.
48
- def on_shutdown client
49
- client.write "Server shutting down. Goodbye."
50
- end
51
- # perform the echo
52
- def on_message client, data
53
- client.write data
54
- end
55
- extend self
56
- end
57
-
58
- # this function call links our HelloWorld application with Rack
59
- run MyHTTPRouter
data/examples/etag.ru DELETED
@@ -1,16 +0,0 @@
1
- # This example uses Rack::ETag to allow for response caching.
2
-
3
- require 'rack'
4
- require 'iodine'
5
-
6
- App = Proc.new do |env|
7
- [200,
8
- { "Content-Type" => "text/html".freeze,
9
- "Content-Length" => "16".freeze },
10
- ['Hello from Rack!'.freeze] ]
11
- end
12
-
13
- use Rack::ConditionalGet
14
- use Rack::ETag, 'public'
15
-
16
- run App
data/examples/hello.ru DELETED
@@ -1,29 +0,0 @@
1
- # This is a simple Hello World Rack application
2
- #
3
- # Running this application from the command line is easy with:
4
- #
5
- # iodine hello.ru
6
- #
7
- # Or, in single thread and single process:
8
- #
9
- # iodine -t 1 -w 1 hello.ru
10
- #
11
- # Benchmark with `ab` or `wrk` (a 5 seconds benchmark with 2000 concurrent clients):
12
- #
13
- # ab -c 2000 -t 5 -n 1000000 -k http://127.0.0.1:3000/
14
- # wrk -c2000 -d5 -t12 http://localhost:3000/
15
-
16
- module HelloWorld
17
- # This is the HTTP response object according to the Rack specification.
18
- RESPONSE = [200, { 'Content-Type' => 'text/html',
19
- 'Content-Length' => '12' }, [ 'Hello World!' ] ]
20
-
21
- # this is function will be called by the Rack server (iodine) for every request.
22
- def self.call env
23
- # simply return the RESPONSE object, no matter what request was received.
24
- RESPONSE
25
- end
26
- end
27
-
28
- # this function call links our HelloWorld application with Rack
29
- run HelloWorld