adhearsion 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +339 -0
- data/Rakefile +108 -0
- data/ahn +195 -0
- data/lib/adhearsion.rb +402 -0
- data/lib/constants.rb +20 -0
- data/lib/core_extensions.rb +157 -0
- data/lib/database_functions.rb +76 -0
- data/lib/rami.rb +822 -0
- data/lib/servlet_container.rb +146 -0
- data/new_projects/Rakefile +100 -0
- data/new_projects/config/adhearsion.sqlite3 +0 -0
- data/new_projects/config/adhearsion.yml +11 -0
- data/new_projects/config/database.rb +50 -0
- data/new_projects/config/database.yml +10 -0
- data/new_projects/config/helpers/drb_server.yml +43 -0
- data/new_projects/config/helpers/factorial.alien.c.yml +1 -0
- data/new_projects/config/helpers/manager_proxy.yml +7 -0
- data/new_projects/config/helpers/micromenus.yml +1 -0
- data/new_projects/config/helpers/micromenus/collab.rb +55 -0
- data/new_projects/config/helpers/micromenus/images/tux.bmp +0 -0
- data/new_projects/config/helpers/micromenus/javascripts/builder.js +131 -0
- data/new_projects/config/helpers/micromenus/javascripts/controls.js +834 -0
- data/new_projects/config/helpers/micromenus/javascripts/dragdrop.js +944 -0
- data/new_projects/config/helpers/micromenus/javascripts/effects.js +956 -0
- data/new_projects/config/helpers/micromenus/javascripts/prototype.js +2319 -0
- data/new_projects/config/helpers/micromenus/javascripts/scriptaculous.js +51 -0
- data/new_projects/config/helpers/micromenus/javascripts/slider.js +278 -0
- data/new_projects/config/helpers/micromenus/javascripts/unittest.js +557 -0
- data/new_projects/config/helpers/micromenus/stylesheets/firefox.css +10 -0
- data/new_projects/config/helpers/micromenus/stylesheets/firefox.xul.css +44 -0
- data/new_projects/config/helpers/weather.yml +1 -0
- data/new_projects/config/helpers/xbmc.yml +1 -0
- data/new_projects/config/migration.rb +53 -0
- data/new_projects/extensions.rb +56 -0
- data/new_projects/helpers/drb_server.rb +32 -0
- data/new_projects/helpers/factorial.alien.c +32 -0
- data/new_projects/helpers/manager_proxy.rb +43 -0
- data/new_projects/helpers/micromenus.rb +374 -0
- data/new_projects/helpers/oscar_wilde_quotes.rb +197 -0
- data/new_projects/helpers/weather.rb +85 -0
- data/new_projects/helpers/xbmc.rb +12 -0
- data/new_projects/logs/database.log +0 -0
- data/test/core_extensions_test.rb +26 -0
- data/test/dial_test.rb +43 -0
- data/test/stress_tests/test.rb +13 -0
- data/test/stress_tests/test.yml +13 -0
- data/test/test_micromenus.rb +0 -0
- metadata +131 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
*$OSCAR_WILDE_QUOTES = %(A cynic is a man who knows the price of everything but the value of nothing.),
|
2
|
+
%(A little sincerity is a dangerous thing, and a great deal of it is absolutely fatal.),
|
3
|
+
%(A man can't be too careful in the choice of his enemies.),
|
4
|
+
%(A man's face is his autobiography. A woman's face is her work of fiction.),
|
5
|
+
%(A poet can survive everything but a misprint.),
|
6
|
+
%(A thing is not necessarily true because a man dies for it.),
|
7
|
+
%(A true friend stabs you in the front.),
|
8
|
+
%(A work of art is the unique result of a unique temperament.),
|
9
|
+
%(Ah, well, then I suppose I shall have to die beyond my means.),
|
10
|
+
%(Alas, I am dying beyond my means.),
|
11
|
+
%(All art is quite useless.),
|
12
|
+
%(All bad poetry springs from genuine feeling.),
|
13
|
+
%(All that I desire to point out is the general principle that life imitates art far more than art imitates life.),
|
14
|
+
%(All women become like their mothers. That is their tragedy. No man does. That's his.),
|
15
|
+
%(Always forgive your enemies - nothing annoys them so much.),
|
16
|
+
%(Ambition is the germ from which all growth of nobleness proceeds.),
|
17
|
+
%(Ambition is the last refuge of the failure.),
|
18
|
+
%(America is the only country that went from barbarism to decadence without civilization in between.),
|
19
|
+
%(An idea that is not dangerous is unworthy of being called an idea at all.),
|
20
|
+
%(Arguments are extremely vulgar, for everyone in good society holds exactly the same opinion.),
|
21
|
+
%(Arguments are to be avoided: they are always vulgar and often convincing.),
|
22
|
+
%(Art is the most intense mode of individualism that the world has known.),
|
23
|
+
%(As long as a woman can look ten years younger than her own daughter, she is perfectly satisfied.),
|
24
|
+
%(As long as war is regarded as wicked, it will always have its fascination. When it is looked upon as vulgar, it will cease to be popular.),
|
25
|
+
%(As yet, Bernard Shaw hasn't become prominent enough to have any enemies, but none of his friends like him.),
|
26
|
+
%(At 46 one must be a miser; only have time for essentials.),
|
27
|
+
%(Between men and women there is no friendship possible. There is passion, enmity, worship, love, but no friendship.),
|
28
|
+
%(Bigamy is having one wife too many. Monogamy is the same.),
|
29
|
+
%(Biography lends to death a new terror.),
|
30
|
+
%(By giving us the opinions of the uneducated, journalism keeps us in touch with the ignorance of the community.),
|
31
|
+
%(Charity creates a multitude of sins.),
|
32
|
+
%(Children begin by loving their parents; after a time they judge them; rarely, if ever, do they forgive them.),
|
33
|
+
%(Conscience and cowardice are really the same things. Conscience is the trade-name of the firm. That is all.),
|
34
|
+
%(Consistency is the last refuge of the unimaginative.),
|
35
|
+
%(Consistency is the last resort of the unimaginative.),
|
36
|
+
%(Conversation about the weather is the last refuge of the unimaginative.),
|
37
|
+
%(Deceiving others. That is what the world calls a romance.),
|
38
|
+
%(Democracy means simply the bludgeoning of the people by the people for the people.),
|
39
|
+
%(Do you really think it is weakness that yields to temptation? I tell you that there are terrible temptations which it requires strength, strength and courage to yield to.),
|
40
|
+
%(Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught.),
|
41
|
+
%(Every portrait that is painted with feeling is a portrait of the artist, not of the sitter.),
|
42
|
+
%(Every saint has a past and every sinner has a future.),
|
43
|
+
%(Everything popular is wrong.),
|
44
|
+
%(Experience is one thing you can't get for nothing.),
|
45
|
+
%(Experience is simply the name we give our mistakes.),
|
46
|
+
%(Fashion is a form of ugliness so intolerable that we have to alter it every six months.),
|
47
|
+
%(Fathers should be neither seen nor heard. That is the only proper basis for family life.),
|
48
|
+
%(Hatred is blind, as well as love.),
|
49
|
+
%(He has no enemies, but is intensely disliked by his friends.),
|
50
|
+
%(He lives the poetry that he cannot write. The others write the poetry that they dare not realise.),
|
51
|
+
%(He must have a truly romantic nature, for he weeps when there is nothing at all to weep about.),
|
52
|
+
%(He was always late on principle, his principle being that punctuality is the thief of time.),
|
53
|
+
%(How can a woman be expected to be happy with a man who insists on treating her as if she were a perfectly normal human being.),
|
54
|
+
%(How marriage ruins a man! It is as demoralizing as cigarettes, and far more expensive.),
|
55
|
+
%(I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself.),
|
56
|
+
%(I am not young enough to know everything.),
|
57
|
+
%(I can resist everything except temptation.),
|
58
|
+
%(I dislike arguments of any kind. They are always vulgar, and often convincing.),
|
59
|
+
%(I have nothing to declare except my genuis.),
|
60
|
+
%(I have the simplest tastes. I am always satisfied with the best.),
|
61
|
+
%(I hope you have not been leading a double life, pretending to be wicked and being really good all the time. That would be hypocrisy.),
|
62
|
+
%(I never travel without my diary. One should always have something sensational to read in the train.),
|
63
|
+
%(I put all my genius into my life; I put only my talent into my works.),
|
64
|
+
%(I regard the theatre as the greatest of all art forms, the most immediate way in which a human being can share with another the sense of what it is to be a human being.),
|
65
|
+
%(I see when men love women. They give them but a little of their lives. But women when they love give everything.),
|
66
|
+
%(I sometimes think that God in creating man somewhat overestimated his ability.),
|
67
|
+
%(I suppose society is wonderfully delightful. To be in it is merely a bore. But to be out of it is simply a tragedy.),
|
68
|
+
%(I think that God, in creating man, somewhat overestimated his ability.),
|
69
|
+
%(I want my food dead. Not sick, not dying, dead.),
|
70
|
+
%(If one cannot enjoy reading a book over and over again, there is no use in reading it at all.),
|
71
|
+
%(If one could only teach the English how to talk, and the Irish how to listen, society here would be quite civilized.),
|
72
|
+
%(If one plays good music, people don't listen and if one plays bad music people don't talk.),
|
73
|
+
%(If there was less sympathy in the world, there would be less trouble in the world.),
|
74
|
+
%(If you are not too long, I will wait here for you all my life.),
|
75
|
+
%(If you pretend to be good, the world takes you very seriously. If you pretend to be bad, it doesn't. Such is the astounding stupidity of optimism.),
|
76
|
+
%(Illusion is the first of all pleasures.),
|
77
|
+
%(In all matters of opinion, our adversaries are insane.),
|
78
|
+
%(In America the President reigns for four years, and Journalism governs forever and ever.),
|
79
|
+
%(In America the young are always ready to give to those who are older than themselves the full benefits of their inexperience.),
|
80
|
+
%(In England people actually try to be brilliant at breakfast. That is so dreadful of them! Only dull people are brilliant at breakfast.),
|
81
|
+
%(In every first novel the hero is the author as Christ or Faust.),
|
82
|
+
%(In married life three is company and two none.),
|
83
|
+
%(It is a very sad thing that nowadays there is so little useless information.),
|
84
|
+
%(It is absurd to divide people into good and bad. People are either charming or tedious.),
|
85
|
+
%(It is an odd thing, but every one who disappears is said to be seen at San Francisco. It must be a delightful city, and possess all the attractions of the next world.),
|
86
|
+
%(It is better to be beautiful than to be good. But... it is better to be good than to be ugly.),
|
87
|
+
%(It is better to have a permanent income than to be fascinating.),
|
88
|
+
%(It is only an auctioneer who can equally and impartially admire all schools of art.),
|
89
|
+
%(It is perfectly monstrous the way people go about, nowadays, saying things against one behind one's back that are absolutely and entirely true.),
|
90
|
+
%(It is through art, and through art only, that we can realise our perfection.),
|
91
|
+
%(It is what you read when you don't have to that determines what you will be when you can't help it.),
|
92
|
+
%(Keep love in your heart. A life without it is like a sunless garden when the flowers are dead.),
|
93
|
+
%(Laughter is not at all a bad beginning for a friendship, and it is far the best ending for one.),
|
94
|
+
%(Life imitates art far more than art imitates Life.),
|
95
|
+
%(Life is far too important a thing ever to talk seriously about.),
|
96
|
+
%(Life is never fair, and perhaps it is a good thing for most of us that it is not.),
|
97
|
+
%(Life is too important to be taken seriously.),
|
98
|
+
%(Man is a rational animal who always loses his temper when he is called upon to act in accordance with the dictates of reason.),
|
99
|
+
%(Man is least himself when he talks in his own person. Give him a mask, and he will tell you the truth.),
|
100
|
+
%(Memory... is the diary that we all carry about with us.),
|
101
|
+
%(Men always want to be a woman's first love - women like to be a man's last romance.),
|
102
|
+
%(Moderation is a fatal thing. Nothing succeeds like excess.),
|
103
|
+
%(Morality is simply the attitude we adopt towards people whom we personally dislike.),
|
104
|
+
%(Most modern calendars mar the sweet simplicity of our lives by reminding us that each day that passes is the anniversary of some perfectly uninteresting event.),
|
105
|
+
%(Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation.),
|
106
|
+
%(Most people die of a sort of creeping common sense, and discover when it is too late that the only things one never regrets are one's mistakes.),
|
107
|
+
%(Mrs. Allonby: No man does. That is his.),
|
108
|
+
%(Music is the art which is most nigh to tears and memory.),
|
109
|
+
%(Music makes one feel so romantic - at least it always gets on one's nerves - which is the same thing nowadays.),
|
110
|
+
%(My great mistake, the fault for which I can't forgive myself, is that one day I ceased my obstinate pursuit of my own individuality.),
|
111
|
+
%(No great artist ever sees things as they really are. If he did, he would cease to be an artist.),
|
112
|
+
%(No man is rich enough to buy back his past.),
|
113
|
+
%(No object is so beautiful that, under certain conditions, it will not look ugly.),
|
114
|
+
%(No woman should ever be quite accurate about her age. It looks so calculating.),
|
115
|
+
%(Nothing can cure the soul but the senses, just as nothing can cure the senses but the soul.),
|
116
|
+
%(Nothing is so aggravating than calmness.),
|
117
|
+
%(Nothing makes one so vain as being told one is a sinner. Conscience makes egotists of us all.),
|
118
|
+
%(Now that the House of Commons is trying to become useful, it does a great deal of harm.),
|
119
|
+
%(Nowadays to be intelligible is to be found out.),
|
120
|
+
%(Of course America had often been discovered before Columbus, but it had always been hushed up.),
|
121
|
+
%(Of course I have played outdoor games. I once played dominoes in an open air cafe in Paris.),
|
122
|
+
%(One can survive everything, nowadays, except death, and live down everything except a good reputation.),
|
123
|
+
%(One of the many lessons that one learns in prison is, that things are what they are and will be what they will be.),
|
124
|
+
%(One should always be in love. That is the reason one should never marry.),
|
125
|
+
%(One should always play fairly when one has the winning cards.),
|
126
|
+
%(One's past is what one is. It is the only way by which people should be judged.),
|
127
|
+
%(Only the shallow know themselves.),
|
128
|
+
%(Ordinary riches can be stolen; real riches cannot. In your soul are infinitely precious things that cannot be taken from you.),
|
129
|
+
%(Our ambition should be to rule ourselves, the true kingdom for each one of us; and true progress is to know more, and be more, and to do more.),
|
130
|
+
%(Patriotism is the virtue of the vicious.),
|
131
|
+
%(Perhaps, after all, America never has been discovered. I myself would say that it had merely been detected.),
|
132
|
+
%(Pessimist: One who, when he has the choice of two evils, chooses both.),
|
133
|
+
%(Please do not shoot the pianist. He is doing his best.),
|
134
|
+
%(Questions are never indiscreet, answers sometimes are.),
|
135
|
+
%(Self-denial is the shining sore on the leprous body of Christianity.),
|
136
|
+
%(Selfishness is not living as one wishes to live, it is asking others to live as one wishes to live.),
|
137
|
+
%(Seriousness is the only refuge of the shallow.),
|
138
|
+
%(She wore far too much rouge last night and not quite enough clothes. That is always a sign of despair in a woman.),
|
139
|
+
%(Some cause happiness wherever they go; others whenever they go.),
|
140
|
+
%(Some of these people need ten years of therapy -ten sentences of mine do not equal ten years of therapy.),
|
141
|
+
%(Success is a science; if you have the conditions, you get the result.),
|
142
|
+
%(The basis of optimism is sheer terror.),
|
143
|
+
%(The books that the world calls immoral are books that show the world its own shame.),
|
144
|
+
%(The cynic knows the price of everything and the value of nothing.),
|
145
|
+
%(The difference between literature and journalism is that journalism is unreadable and literature is not read.),
|
146
|
+
%(The English country gentleman galloping after a fox - The unspeakable in full pursuit of the uneatable.),
|
147
|
+
%(The General was essentially a man of peace, except of course in his domestic affairs.),
|
148
|
+
%(The good ended happily, and the bad unhappily. That is what fiction means.),
|
149
|
+
%(The imagination imitates. It is the critical spirit that creates.),
|
150
|
+
%(The man who can dominate a London dinner-table can dominate the world.),
|
151
|
+
%(The moment you think you understand a great work of art, it's dead for you.),
|
152
|
+
%(The old believe everything, the middle-aged suspect everything, the young know everything.),
|
153
|
+
%(The one charm about marriage is that it makes a life of deception absolutely necessary for both parties.),
|
154
|
+
%(The only thing to do with good advice is to pass it on. It is never of any use to oneself.),
|
155
|
+
%(The only way to get rid of temptation is to yield to it... I can resist everything but temptation.),
|
156
|
+
%(The public is wonderfully tolerant. It forgives everything except genius.),
|
157
|
+
%(The pure and simple truth is rarely pure and never simple.),
|
158
|
+
%(The salesman knows nothing of what he is selling save that he is charging a great deal too much for it.),
|
159
|
+
%(The true mystery of the world is the visible, not the invisible.),
|
160
|
+
%(The truth is rarely pure and never simple.),
|
161
|
+
%(The typewriting machine, when played with expression, is no more annoying than the piano when played by a sister or near relation.),
|
162
|
+
%(The world has grown suspicious of anything that looks like a happily married life.),
|
163
|
+
%(The world is divided into two classes, those who believe the incredible, and those who do the improbable.),
|
164
|
+
%(There are only two kinds of people who are really fascinating - people who know absolutely everything, and people who know absolutely nothing.),
|
165
|
+
%(There are only two tragedies in life: one is not getting what one wants, and the other is getting it.),
|
166
|
+
%(There is no sin except stupidity.),
|
167
|
+
%(There is no such thing as a moral or an immoral book. Books are well written, or badly written.),
|
168
|
+
%(There is no such thing as an omen. Destiny does not send us heralds. She is too wise or too cruel for that.),
|
169
|
+
%(There is nothing in the world like the devotion of a married woman. It is a thing no married man knows anything about.),
|
170
|
+
%(There is nothing so difficult to marry as a large nose.),
|
171
|
+
%(There is only one thing in life worse than being talked about, and that is not being talked about.),
|
172
|
+
%(These days man knows the price of everything, but the value of nothing.),
|
173
|
+
%(This suspense is terrible. I hope it will last.),
|
174
|
+
%(Those whom the gods love grow young.),
|
175
|
+
%(To expect the unexpected shows a thoroughly modern intellect.),
|
176
|
+
%(To lose one parent may be regarded as a misfortune; to lose both looks like carelessness.),
|
177
|
+
%(To love oneself is the beginning of a lifelong romance.),
|
178
|
+
%(True friends stab you in the front.),
|
179
|
+
%(We are all in the gutter, but some of us are looking at the stars.),
|
180
|
+
%(What we have to do, what at any rate it is our duty to do, is to revive the old art of Lying.),
|
181
|
+
%(When a man has once loved a woman he will do anything for her except continue to love her.),
|
182
|
+
%(When good Americans die they go to Paris.),
|
183
|
+
%(When I was young I thought that money was the most important thing in life; now that I am old I know that it is.),
|
184
|
+
%(When the gods wish to punish us they answer our prayers.),
|
185
|
+
%(Whenever people agree with me I always feel I must be wrong.),
|
186
|
+
%(Who, being loved, is poor?),
|
187
|
+
%(Why was I born with such contemporaries?),
|
188
|
+
%(Woman begins by resisting a man's advances and ends by blocking his retreat.),
|
189
|
+
%(Women are made to be loved, not understood.),
|
190
|
+
%(Women are never disarmed by compliments. Men always are. That is the difference between the sexes.),
|
191
|
+
%(Work is the curse of the drinking classes.)
|
192
|
+
|
193
|
+
# Returns a random Oscar Wilde quote from a collection of 191 different snippets
|
194
|
+
# from his many works.
|
195
|
+
def oscar_wilde_quote
|
196
|
+
$OSCAR_WILDE_QUOTES[rand($OSCAR_WILDE_QUOTES.length)]
|
197
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
# Uses Yahoo's fantastic weather RSS feed to resolve the weather information for either
|
4
|
+
# (American) zip codes or search queries. "More info":http://developer.yahoo.com/weather
|
5
|
+
class Weather
|
6
|
+
|
7
|
+
# Yahoo's RSS weather service offers a numerical code that describes the conditions of a
|
8
|
+
# forecasted day. Jay went through these codes creating the following array of Asterisk's
|
9
|
+
# GSM audio files that best represent each condition. The numerical code associates with
|
10
|
+
# the respective index in this array (error 0 is tornado, etc). When pulling an String from
|
11
|
+
# this array, be sure to call the split() method on it to break it up between spaces!
|
12
|
+
WEATHER_CODES = ["tornado", "storm", "hurricane", "severe thunderstorm", "thunderstorm",
|
13
|
+
"rainy snowy", "rainy sleet", "snowy sleet", "icy misty", "misty", "icy rainy", "rainy",
|
14
|
+
"rainy", "snowy", "snowy", "snowy", "snow", "hail", "sleet", "", "foggy", "foggy", "foggy",
|
15
|
+
"", "windy", "low temperature", "cloudy", "mostly cloudy in-the evening",
|
16
|
+
"mostly cloudy in-the day", "partly cloudy in-the evening", "partly cloudy in-the day",
|
17
|
+
"clear in-the evening", "sunny", "good in-the evening", "good in-the day",
|
18
|
+
"partially rainy with hail", "high temperature", "thunderstorm", "scattered thunderstorm",
|
19
|
+
"scattered thunderstorm", "scattered rain", "snowy", "scattered snow", "snowy",
|
20
|
+
"partly cloudy", "thunderstorm", "snowy", "thunderstorm"]
|
21
|
+
|
22
|
+
DAYS = %w(sunday monday tuesday wednesday thursday friday saturday)
|
23
|
+
DAYS_ABBREV = DAYS.abbrev
|
24
|
+
|
25
|
+
def self.report where
|
26
|
+
w = weather where
|
27
|
+
nextdays = DAYS.dup
|
28
|
+
nextdays += nextdays.slice! 0, Time.now.wday
|
29
|
+
nextdays.slice! 4, 7 # Only a four-day forecast
|
30
|
+
|
31
|
+
today = w.forecasts[nextdays.shift]
|
32
|
+
rep = %W(weather is-currently #{w.current.temp} degrees today high #{today.high} low #{today.low}) + w.current.desc
|
33
|
+
|
34
|
+
tomorrow = w.forecasts[nextdays.shift]
|
35
|
+
rep += %W(weather tomorrow high #{tomorrow.high} low #{tomorrow.low}) + tomorrow.desc
|
36
|
+
|
37
|
+
until nextdays.empty? do
|
38
|
+
day = w.forecasts[nextdays.shift]
|
39
|
+
rep += %W(weather #{4 - nextdays.size} days from now high #{day.high} low #{day.low}) + day.desc
|
40
|
+
end
|
41
|
+
rep
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.weather where
|
45
|
+
puts "Resolving ID"
|
46
|
+
id = where.simplify.is_a?(Fixnum) ? where : get_id(where)
|
47
|
+
puts "Getting Yahoo Data"
|
48
|
+
url = "http://xml.weather.yahoo.com/forecastrss/#{id}_#{($HELPERS['weather'].units || 'fahrenheit')[0].chr}.xml"
|
49
|
+
begin xml = REXML::Document.new open(url).read rescue return nil end
|
50
|
+
xml2hash xml.elements
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def self.xml2hash xml
|
55
|
+
hash = { :current => {}, :forecasts => {} }
|
56
|
+
hash.current.temp = xml['/rss/channel/item/yweather:condition/@temp'].to_s
|
57
|
+
hash.current.desc = WEATHER_CODES[xml['/rss/channel/item/yweather:condition/@code'].to_s.to_i].split || []
|
58
|
+
forecasts = {}
|
59
|
+
xml.each '//yweather:forecast' do |day|
|
60
|
+
ats = day.attributes
|
61
|
+
fullname = DAYS_ABBREV[ats['day'].downcase]
|
62
|
+
hash.forecasts[fullname] = {}
|
63
|
+
hash.forecasts[fullname].low = ats['low']
|
64
|
+
hash.forecasts[fullname].high = ats['high']
|
65
|
+
hash.forecasts[fullname].desc = WEATHER_CODES[ats['code'].to_i].split
|
66
|
+
end
|
67
|
+
hash
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_id where
|
71
|
+
query = URI.escape where
|
72
|
+
response = open("http://xoap.weather.com/search/search?where=#{query}").read
|
73
|
+
response.gsub!(/<\?.*\?>/,'').gsub!(/<\!--.*-->/, '')
|
74
|
+
doc = REXML::Document.new response
|
75
|
+
results = doc.elements.to_a('/search/loc')
|
76
|
+
if results.size.zero?
|
77
|
+
puts "Couldn't resolve weather information for #{where}"
|
78
|
+
nil
|
79
|
+
else results[0].attributes['id']
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def weather(loc="Dallas, Texas") Weather.weather loc end
|
85
|
+
def weather_report(loc="Dallas, Texas") Weather.report loc end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class XBMC
|
2
|
+
KEY_MAPPING = { '1'=>37, '2'=>166, '4'=>169, '5'=>11, '6'=>168, '8'=>167 }
|
3
|
+
KEY_MAPPING.default = 0
|
4
|
+
def XBMC.translate(key) KEY_MAPPING[key] end
|
5
|
+
def XBMC.method_missing name, hash={}
|
6
|
+
puts 'method missinggg'
|
7
|
+
args = []
|
8
|
+
hash = { :parameter => hash} unless hash.is_a? Hash
|
9
|
+
hash.merge({:command => name}).each { |k,v| args << "#{k}=#{v}" }
|
10
|
+
open("http://#{hash.ip || $HELPERS.xbmc.ip}/xbmcCmds/xbmcHttp?#{args * '&'}").read
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
class CoreExtensionsTest < Test::Unit::TestCase
|
3
|
+
def test_hash
|
4
|
+
value = "I've changed my plea to guilty because freedom is wasted on me. -- Morrissey"
|
5
|
+
|
6
|
+
x = Hash.new
|
7
|
+
|
8
|
+
x[:kewlz0rz] = value
|
9
|
+
assert_equal x[:kewlz0rz], value
|
10
|
+
assert_equal x.kewlz0rz, value
|
11
|
+
|
12
|
+
x.sweetness = value
|
13
|
+
assert_equal x.sweetness, value
|
14
|
+
|
15
|
+
x['awesome'] = value
|
16
|
+
assert_equal x['awesome'], value
|
17
|
+
assert_equal x.awesome, value
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_regexp_hack
|
22
|
+
assert_false(/123/ === 123)
|
23
|
+
# TODO: Also test that running this in the dialplan DSL
|
24
|
+
# produces different results.
|
25
|
+
end
|
26
|
+
end
|
data/test/dial_test.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
class DialTest < Test::Unit::TestCase
|
3
|
+
|
4
|
+
def initialize name
|
5
|
+
class << self
|
6
|
+
include Asterisk
|
7
|
+
end
|
8
|
+
super name
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_protocol_sugar
|
12
|
+
num = 1337
|
13
|
+
name = "lordxenu"
|
14
|
+
namesym = name.to_sym
|
15
|
+
|
16
|
+
sipnum, sipname = "SIP/#{num}", "SIP/#{name}"
|
17
|
+
iaxnum, iaxname = "IAX2/#{num}", "IAX2/#{name}"
|
18
|
+
zapnum, zapname = "Zap/#{num}", "Zap/#{name}"
|
19
|
+
|
20
|
+
sipnumtests = [SIP/num, SIP(num), SIP[num]]
|
21
|
+
iaxnumtests = [IAX/num, IAX(num), IAX[num], IAX2/num, IAX2(num), IAX2[num]]
|
22
|
+
zapnumtests = [ZAP/num, ZAP(num), ZAP[num], Zap/num, Zap(num), Zap[num]]
|
23
|
+
|
24
|
+
sipnametests = [SIP/name, SIP(name), SIP[name], SIP/namesym, SIP(namesym), SIP[namesym]]
|
25
|
+
iaxnametests = [IAX/name, IAX(name), IAX[name], IAX/namesym, IAX(namesym), IAX[namesym],
|
26
|
+
IAX2/name, IAX2(name), IAX2[name], IAX2/namesym, IAX2(namesym), IAX2[namesym]]
|
27
|
+
zapnametests = [ZAP/name, ZAP(name), ZAP[name], ZAP/namesym, ZAP(namesym), ZAP[namesym]]
|
28
|
+
|
29
|
+
sipnumtests.each do |test| assert_equal test, sipnum end
|
30
|
+
iaxnumtests.each do |test| assert_equal test, iaxnum end
|
31
|
+
zapnumtests.each do |test| assert_equal test, zapnum end
|
32
|
+
|
33
|
+
sipnametests.each do |test| assert_equal test, sipname end
|
34
|
+
iaxnametests.each do |test| assert_equal test, iaxname end
|
35
|
+
zapnametests.each do |test| assert_equal test, zapname end
|
36
|
+
end
|
37
|
+
|
38
|
+
#def test_dialing_complex_arrays
|
39
|
+
#end
|
40
|
+
|
41
|
+
#def test_dialing_hashes
|
42
|
+
#end
|
43
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: adhearsion
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.7.0
|
7
|
+
date: 2006-12-26 00:00:00 -06:00
|
8
|
+
summary: Adhearsion is a professional integration system for integrating anything and everything.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: admin -at- jicksta dot com
|
12
|
+
homepage: http://adhearsion.com
|
13
|
+
rubyforge_project: adhearsion
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: .
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Jay Phillips
|
31
|
+
files:
|
32
|
+
- ahn
|
33
|
+
- docs
|
34
|
+
- lib
|
35
|
+
- LICENSE
|
36
|
+
- new_projects
|
37
|
+
- Rakefile
|
38
|
+
- test
|
39
|
+
- lib/adhearsion.rb
|
40
|
+
- lib/constants.rb
|
41
|
+
- lib/core_extensions.rb
|
42
|
+
- lib/database_functions.rb
|
43
|
+
- lib/rami.rb
|
44
|
+
- lib/servlet_container.rb
|
45
|
+
- new_projects/config
|
46
|
+
- new_projects/extensions.rb
|
47
|
+
- new_projects/helpers
|
48
|
+
- new_projects/logs
|
49
|
+
- new_projects/Rakefile
|
50
|
+
- new_projects/config/adhearsion.sqlite3
|
51
|
+
- new_projects/config/adhearsion.yml
|
52
|
+
- new_projects/config/database.rb
|
53
|
+
- new_projects/config/database.yml
|
54
|
+
- new_projects/config/helpers
|
55
|
+
- new_projects/config/migration.rb
|
56
|
+
- new_projects/config/helpers/drb_server.yml
|
57
|
+
- new_projects/config/helpers/factorial.alien.c.yml
|
58
|
+
- new_projects/config/helpers/manager_proxy.yml
|
59
|
+
- new_projects/config/helpers/micromenus
|
60
|
+
- new_projects/config/helpers/micromenus.yml
|
61
|
+
- new_projects/config/helpers/weather.yml
|
62
|
+
- new_projects/config/helpers/xbmc.yml
|
63
|
+
- new_projects/config/helpers/micromenus/collab.rb
|
64
|
+
- new_projects/config/helpers/micromenus/images
|
65
|
+
- new_projects/config/helpers/micromenus/javascripts
|
66
|
+
- new_projects/config/helpers/micromenus/stylesheets
|
67
|
+
- new_projects/config/helpers/micromenus/images/tux.bmp
|
68
|
+
- new_projects/config/helpers/micromenus/javascripts/builder.js
|
69
|
+
- new_projects/config/helpers/micromenus/javascripts/controls.js
|
70
|
+
- new_projects/config/helpers/micromenus/javascripts/dragdrop.js
|
71
|
+
- new_projects/config/helpers/micromenus/javascripts/effects.js
|
72
|
+
- new_projects/config/helpers/micromenus/javascripts/prototype.js
|
73
|
+
- new_projects/config/helpers/micromenus/javascripts/scriptaculous.js
|
74
|
+
- new_projects/config/helpers/micromenus/javascripts/slider.js
|
75
|
+
- new_projects/config/helpers/micromenus/javascripts/unittest.js
|
76
|
+
- new_projects/config/helpers/micromenus/stylesheets/firefox.css
|
77
|
+
- new_projects/config/helpers/micromenus/stylesheets/firefox.xul.css
|
78
|
+
- new_projects/helpers/drb_server.rb
|
79
|
+
- new_projects/helpers/factorial.alien.c
|
80
|
+
- new_projects/helpers/manager_proxy.rb
|
81
|
+
- new_projects/helpers/micromenus.rb
|
82
|
+
- new_projects/helpers/oscar_wilde_quotes.rb
|
83
|
+
- new_projects/helpers/weather.rb
|
84
|
+
- new_projects/helpers/xbmc.rb
|
85
|
+
- new_projects/logs/database.log
|
86
|
+
- test/core_extensions_test.rb
|
87
|
+
- test/dial_test.rb
|
88
|
+
- test/stress_tests
|
89
|
+
- test/test_micromenus.rb
|
90
|
+
- test/stress_tests/test.rb
|
91
|
+
- test/stress_tests/test.yml
|
92
|
+
test_files: []
|
93
|
+
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
extra_rdoc_files: []
|
97
|
+
|
98
|
+
executables:
|
99
|
+
- ahn
|
100
|
+
extensions: []
|
101
|
+
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
dependencies:
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: activerecord
|
107
|
+
version_requirement:
|
108
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.14.4
|
113
|
+
version:
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: activesupport
|
116
|
+
version_requirement:
|
117
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 1.3.1
|
122
|
+
version:
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: rake
|
125
|
+
version_requirement:
|
126
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 0.7.1
|
131
|
+
version:
|