adhd 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ module Adhd
2
+ class Node
3
+
4
+ def initialize(config)
5
+ end
6
+
7
+ def event_handler(ev)
8
+ puts ev
9
+ end
10
+
11
+ end
12
+ end
13
+
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'eventmachine'
3
+
4
+ module Adhd
5
+
6
+ # This module gets mixed into the EventMachine reactor loop, and sends events
7
+ # to our Adhd::Node which is hanging around waiting for shit to happen.
8
+ #
9
+ # Currently it just illustrates the fact that we can fire up an EventMachine
10
+ # and have this reactor get mixed in as glue code to our Node.
11
+ #
12
+ # A call like:
13
+ # EM.start_server '192.168.1.104', 10000, Adhd::UnusedReactor, @node
14
+ #
15
+ # inside the EM.run block will start a server on port 10000 when we need a
16
+ # server to do something for us. We can then change it into maybe a file
17
+ # streaming server or whatever we need.
18
+ #
19
+ module UnusedReactor
20
+
21
+ def initialize(node)
22
+ puts "Something connected to our server..."
23
+ @node = node
24
+ end
25
+
26
+ def receive_data data
27
+ @node.event_handler("received event: #{data}")
28
+ end
29
+
30
+ end
31
+
32
+ # A reactor that makes a long-running request to a CouchDB instance (using
33
+ # Comet technology) and continually sends any update notifications that it
34
+ # gets back to its @node.
35
+ #
36
+ module DbUpdateReactor
37
+
38
+ def initialize(node)
39
+ puts "Db update reactor start..."
40
+ @node = node
41
+ end
42
+
43
+ # Makes a long-running request to a CouchDB instance's _changes URL.
44
+ #
45
+ def post_init
46
+ send_data "GET http://192.168.1.104:5984/bar_node_db/_changes?feed=continuous&heartbeat=5000\r\n\r\n"
47
+ end
48
+
49
+ # Shoots update notifications from CouchDB to the @node.
50
+ #
51
+ def receive_data data
52
+ @node.event_handler(data)
53
+ end
54
+
55
+ end
56
+ end
57
+
@@ -0,0 +1,29 @@
1
+ require 'ostruct'
2
+ require 'yaml'
3
+
4
+ class Hash
5
+ def to_openstruct
6
+ mapped = {}
7
+ each{ |key,value| mapped[key] = value.to_openstruct }
8
+ OpenStruct.new(mapped)
9
+ end
10
+ end
11
+
12
+ class Object
13
+ def to_openstruct
14
+ self
15
+ end
16
+ end
17
+
18
+ class Array
19
+ def to_openstruct
20
+ map{ |el| el.to_openstruct }
21
+ end
22
+ end
23
+
24
+ module YAML
25
+ def self.load_openstruct(source)
26
+ self.load(source).to_openstruct
27
+ end
28
+ end
29
+
@@ -0,0 +1,451 @@
1
+ /*
2
+ Design by Free CSS Templates
3
+ http://www.freecsstemplates.org
4
+ Released for free under a Creative Commons Attribution 2.5 License
5
+ */
6
+
7
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ background: #F7F7F7 url(images/img01.jpg) repeat left top;
11
+ font-family: Georgia, "Times New Roman", Times, serif;
12
+ font-size: 14px;
13
+ color: #5A554E;
14
+ }
15
+
16
+ h1, h2, h3 {
17
+ margin: 0;
18
+ padding: 0;
19
+ font-weight: normal;
20
+ color: #32639A;
21
+ font-family: Georgia, "Times New Roman", Times, serif;
22
+ }
23
+
24
+ h1 {
25
+ font-size: 2em;
26
+ }
27
+
28
+ h2 {
29
+ font-size: 2.4em;
30
+ }
31
+
32
+ h3 {
33
+ font-size: 1.6em;
34
+ }
35
+
36
+ p, ul, ol {
37
+ margin-top: 0;
38
+ line-height: 200%;
39
+ font-family: "Trebuchet MS", Georgia, "Times New Roman", Times, serif;
40
+ }
41
+
42
+ ul, ol {
43
+ margin: 0px;
44
+ padding: 0px;
45
+ list-style: none;
46
+ }
47
+
48
+ a {
49
+ text-decoration: underline;
50
+ color: #516C00;
51
+ }
52
+
53
+ a:hover {
54
+ text-decoration: none;
55
+ }
56
+
57
+ h2 a {
58
+ text-decoration: none;
59
+ }
60
+
61
+ #wrapper {
62
+ margin: 0px;
63
+ padding: 0px;
64
+ background: url(images/img02.jpg) repeat-x left top;
65
+ }
66
+
67
+ /* Header */
68
+
69
+ #header {
70
+ width: 1000px;
71
+ height: 235px;
72
+ margin: 0 auto;
73
+ padding: 0px;
74
+ background: url(images/img03.jpg) no-repeat left top;
75
+ }
76
+
77
+ /* Logo */
78
+
79
+ #logo {
80
+ float: left;
81
+ margin: 0;
82
+ padding: 115px 0px 0px 50px;
83
+ color: #000000;
84
+ }
85
+
86
+ #logo h1, #logo p {
87
+ margin: 0;
88
+ padding: 0;
89
+ font-family: Georgia, "Times New Roman", Times, serif;
90
+ }
91
+
92
+ #logo h1 {
93
+ letter-spacing: -1px;
94
+ text-transform: lowercase;
95
+ font-size: 44px;
96
+ }
97
+
98
+ #logo h1 a {
99
+ color: #FFFFFF;
100
+ }
101
+
102
+ #logo p {
103
+ margin: -30px 0px 0px 0px;
104
+ padding: 26px 0 0 2px;
105
+ font: normal 19px Georgia, "Times New Roman", Times, serif;
106
+ color: #C5E8FF;
107
+ }
108
+
109
+ #logo a {
110
+ border: none;
111
+ background: none;
112
+ text-decoration: none;
113
+ color: #C5E8FF;
114
+ }
115
+
116
+ /* Search */
117
+
118
+ #search {
119
+ float: right;
120
+ width: 280px;
121
+ height: 60px;
122
+ padding: 20px 0px 0px 0px;
123
+ background: #E2E2E2;
124
+ border-bottom: 4px solid #FFFFFF;
125
+ }
126
+
127
+ #search form {
128
+ height: 41px;
129
+ margin: 0;
130
+ padding: 10px 0 0 20px;
131
+ }
132
+
133
+ #search fieldset {
134
+ margin: 0;
135
+ padding: 0;
136
+ border: none;
137
+ }
138
+
139
+ #search-text {
140
+ width: 170px;
141
+ padding: 6px 5px 2px 5px;
142
+ border: 1px solid #DEDEDE;
143
+ background: #FFFFFF;
144
+ text-transform: lowercase;
145
+ font: normal 11px Arial, Helvetica, sans-serif;
146
+ color: #5D781D;
147
+ }
148
+
149
+ #search-submit {
150
+ width: 50px;
151
+ height: 22px;
152
+ border: none;
153
+ background: #B9B9B9;
154
+ color: #000000;
155
+ }
156
+
157
+ #banner {
158
+ margin-bottom: 20px;
159
+ border: 12px #ECECEC solid;
160
+ }
161
+
162
+ /* Menu */
163
+
164
+ #menu {
165
+ width: 1000px;
166
+ height: 65px;
167
+ margin: 0 auto;
168
+ padding: 0;
169
+ background: url(images/img04.jpg) no-repeat left top;
170
+ }
171
+
172
+ #menu ul {
173
+ float: right;
174
+ margin: 0;
175
+ padding: 0px 25px 0px 0px;
176
+ list-style: none;
177
+ line-height: normal;
178
+ }
179
+
180
+ #menu li {
181
+ float: left;
182
+ }
183
+
184
+ #menu a {
185
+ display: block;
186
+ width: 120px;
187
+ height: 39px;
188
+ margin-left: 10px;
189
+ padding-top: 15px;
190
+ background: url(images/img05.jpg) repeat-x left top;
191
+ font-family: Georgia, "Times New Roman", Times, serif;
192
+ text-decoration: none;
193
+ text-align: center;
194
+ font-size: 18px;
195
+ font-weight: normal;
196
+ color: #FFFFFF;
197
+ border: none;
198
+ }
199
+
200
+ #menu a:hover, #menu .current_page_item a {
201
+ text-decoration: none;
202
+ }
203
+
204
+ #menu .current_page_item a {
205
+ background: url(images/img06.jpg) no-repeat left top;
206
+ padding-left: 0;
207
+ color: #493E2B;
208
+ }
209
+
210
+ /* Page */
211
+
212
+ #page {
213
+ width: 900px;
214
+ margin: 0px auto;
215
+ padding: 40px 50px 0px 50px;
216
+ background: #FFFFFF;
217
+ }
218
+
219
+ /* Content */
220
+
221
+ #content {
222
+ float: left;
223
+ width: 570px;
224
+ padding: 0px 0px 0px 0px;
225
+ }
226
+
227
+ .post {
228
+ margin-bottom: 15px;
229
+ }
230
+
231
+ .post-bgtop {
232
+ }
233
+
234
+ .post-bgbtm {
235
+ }
236
+
237
+ .post .title {
238
+ margin-bottom: 10px;
239
+ padding: 12px 0 0 0px;
240
+ letter-spacing: -.5px;
241
+ font-size: 36px;
242
+ color: #493E2B;
243
+ }
244
+
245
+ .post .title a {
246
+ color: #493E2B;
247
+ border: none;
248
+ }
249
+
250
+ .post .meta {
251
+ margin: -10px 0px 0px 0px;
252
+ padding: 0px 0px 10px 0px;
253
+ letter-spacing: -1px;
254
+ font-size: 23px;
255
+ font-weight: normal;
256
+ color: #6E8D3D;
257
+ font-family: Georgia, "Times New Roman", Times, serif;
258
+ }
259
+
260
+ .post .meta .date {
261
+ float: left;
262
+ }
263
+
264
+ .post .meta .posted {
265
+ float: right;
266
+ }
267
+
268
+ .post .meta a {
269
+ }
270
+
271
+ .post .entry {
272
+ background: url(images/img08.jpg) no-repeat left top;
273
+ padding: 25px 0px 0px 0px;
274
+ text-align: justify;
275
+ }
276
+
277
+ .links {
278
+ padding-top: 20px;
279
+ }
280
+
281
+ .more {
282
+ padding-left: 16px;
283
+ background: url(images/img10.gif) no-repeat left 3px;
284
+ text-decoration: underline;
285
+ font-size: 12px;
286
+ font-weight: normal;
287
+ }
288
+
289
+ .comments {
290
+ padding-left: 18px;
291
+ background: url(images/img11.gif) no-repeat left 4px;
292
+ text-decoration: underline;
293
+ font-size: 12px;
294
+ font-weight: normal;
295
+ }
296
+
297
+
298
+ /* Sidebar */
299
+
300
+ #sidebar {
301
+ float: right;
302
+ width: 273px;
303
+ padding: 0px;
304
+ color: #787878;
305
+ }
306
+
307
+ #sidebar ul {
308
+ margin: 0;
309
+ padding: 0;
310
+ list-style: none;
311
+ }
312
+
313
+ #sidebar li {
314
+ margin: 0;
315
+ padding: 0;
316
+ }
317
+
318
+ #sidebar li ul {
319
+ margin: 0px 0px;
320
+ padding-bottom: 20px;
321
+ }
322
+
323
+ #sidebar li li {
324
+ line-height: 35px;
325
+ margin: 0px;
326
+ padding: 2px 0px;
327
+ border-left: none;
328
+ }
329
+
330
+ #sidebar li li span {
331
+ height: 19px;
332
+ margin-right: 16px;
333
+ padding: 4px 12px;
334
+ background: #3D2A0B url(images/img12.jpg) repeat-x left top;
335
+ font-size: 12px;
336
+ color: #FFFFFF;
337
+ }
338
+
339
+ #sidebar li li span a {
340
+ color: #FFFFFF;
341
+ }
342
+
343
+ #sidebar h2 {
344
+ height: 65px;
345
+ background: url(images/img09.jpg) no-repeat left bottom;
346
+ letter-spacing: -.5px;
347
+ font-size: 28px;
348
+ color: #493E2B;
349
+ }
350
+
351
+ #sidebar p {
352
+ margin: 0 0px;
353
+ padding: 0px 0px 30px 0px;
354
+ text-align: justify;
355
+ }
356
+
357
+ #sidebar p strong {
358
+ color: #4A3E29;
359
+ }
360
+
361
+ #sidebar a {
362
+ border: none;
363
+ }
364
+
365
+ #sidebar a:hover {
366
+ }
367
+
368
+ /* Calendar */
369
+
370
+ #calendar {
371
+ }
372
+
373
+ #calendar_wrap {
374
+ padding: 20px;
375
+ }
376
+
377
+ #calendar table {
378
+ width: 100%;
379
+ }
380
+
381
+ #calendar tbody td {
382
+ text-align: center;
383
+ }
384
+
385
+ #calendar #next {
386
+ text-align: right;
387
+ }
388
+
389
+ /* Footer */
390
+
391
+ #footer-content {
392
+ width: 900px;
393
+ height: 255px;
394
+ margin: 0 auto;
395
+ padding: 60px 50px 0px 50px;
396
+ background: url(images/img15.jpg) no-repeat left top;
397
+ font-size: 12px;
398
+ color: #887450;
399
+ }
400
+
401
+ #footer-content .column1 {
402
+ float: left;
403
+ width: 570px;
404
+ }
405
+
406
+ #footer-content .column2 {
407
+ float: right;
408
+ width: 273px;
409
+ }
410
+
411
+ #footer-content h2 {
412
+ padding-bottom: 10px;
413
+ font-size: 22px;
414
+ color: #E3D2B6;
415
+ }
416
+
417
+ #footer-content strong {
418
+ color: #E3D2B6;
419
+ }
420
+
421
+ #footer-content a {
422
+ color: #AA8B55;
423
+ }
424
+
425
+ #footer-content a:hover {
426
+ color: #AA8B55;
427
+ }
428
+
429
+ .list li {
430
+ margin-bottom: 6px;
431
+ }
432
+
433
+ #footer {
434
+ height: 50px;
435
+ margin: 0 auto;
436
+ padding: 0px 0 15px 0;
437
+ font-family: Arial, Helvetica, sans-serif;
438
+ }
439
+
440
+ #footer p {
441
+ margin: 0;
442
+ line-height: normal;
443
+ font-size: 12px;
444
+ text-align: center;
445
+ color: #82A2B9;
446
+ }
447
+
448
+ #footer a {
449
+ text-decoration: underline;
450
+ color: #82A2B9;
451
+ }