ask_stack 0.0.1
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.
- data/.gitignore +1 -0
- data/README.md +74 -0
- data/Rakefile +7 -0
- data/ask_stack.gemspec +23 -0
- data/bin/ask_stack +3 -0
- data/lib/ask_stack.rb +122 -0
- data/similar.txt +120 -0
- data/vendor/selenium-server-standalone-2.0b3.jar +0 -0
- metadata +74 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gmail.yml
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# AskStack
|
2
|
+
|
3
|
+
This is an experimental program that lets you compose a Stack Overflow
|
4
|
+
question in a text file and then automate the submission of it.
|
5
|
+
|
6
|
+
The reason I started this experiment is simple. I hate filling in web
|
7
|
+
forms. They feel retarded as well as unhealthy after you have gotten
|
8
|
+
used to using Vim and maneuvering in the Unix shell environment.
|
9
|
+
|
10
|
+
This project is alpha and is only a proof of concept at this stage.
|
11
|
+
|
12
|
+
## Instructions
|
13
|
+
|
14
|
+
First you have to fire up an instance of SeleniumRC on your computer.
|
15
|
+
|
16
|
+
You can start SeleniumRC with
|
17
|
+
|
18
|
+
java -jar vendor/selenium-server-standalone-2.0b3.jar
|
19
|
+
|
20
|
+
This should be done in a different terminal window from the one you will
|
21
|
+
be running `ask_stack` in. You only have to start up the Selenium
|
22
|
+
standalone server once. You can leave this running in the background
|
23
|
+
indefinitely.
|
24
|
+
|
25
|
+
The next step is to compose your question in a text file.
|
26
|
+
|
27
|
+
The text file (let's call this one question.txt) should follow this
|
28
|
+
format:
|
29
|
+
|
30
|
+
How to use omniauth to make authenticated calls to services?
|
31
|
+
|
32
|
+
I've received a token / secret from a service using OmniAuth and can
|
33
|
+
store it for users, but I'm stuck as to how to actually use these to
|
34
|
+
call a service.
|
35
|
+
|
36
|
+
The closest thing I've seen to this question is here but the way
|
37
|
+
he's solved that there doesn't feel right. I feel like OmniAuth
|
38
|
+
likely does this all for you if you know what you're doing.
|
39
|
+
|
40
|
+
Netflix has a pretty involved auth process, so I was hoping to skirt
|
41
|
+
all of this by using OmniAuth to abstract me from all of this.
|
42
|
+
|
43
|
+
Given that I have a token and secret for a user, how to use these in
|
44
|
+
calling a service like Netflix?
|
45
|
+
|
46
|
+
Many thanks :)
|
47
|
+
|
48
|
+
ruby-on-rails ruby omniauth netflix
|
49
|
+
|
50
|
+
The first line is the title of the question, then there is a blank line,
|
51
|
+
and then the body of the question follows. The last line of the text
|
52
|
+
file should contain your tags for the question, separated by spaces.
|
53
|
+
The body of the question can contain any of the special markup and
|
54
|
+
formatting that Stack Overflow accepts.
|
55
|
+
|
56
|
+
Note there is no autocompletion of tags or auto-suggestion of similar
|
57
|
+
questions (yet). So try to choose tags that you've seen before on S.O.
|
58
|
+
|
59
|
+
Finally, before submitting your question, you need to put your OpenID
|
60
|
+
credentials in a ask_stack.yml file in the directory where you're going
|
61
|
+
to run the program from. For this proof of concept version, only Google
|
62
|
+
is accepted as an OpenID provider.
|
63
|
+
|
64
|
+
The `ask_stack.yml` should look like this:
|
65
|
+
|
66
|
+
username: danchoi@gmail.com
|
67
|
+
password: secret
|
68
|
+
|
69
|
+
Now you can try submitting your question like this.
|
70
|
+
|
71
|
+
ask_stack < question.txt
|
72
|
+
|
73
|
+
|
74
|
+
|
data/Rakefile
ADDED
data/ask_stack.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "ask_stack"
|
5
|
+
s.version = '0.0.1'
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.required_ruby_version = '>= 1.9.0'
|
8
|
+
|
9
|
+
s.authors = ["Daniel Choi"]
|
10
|
+
s.email = ["dhchoi@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/danchoi/ask_stack"
|
12
|
+
s.summary = %q{Post questions to StackOverflow from the unix command line}
|
13
|
+
s.description = %q{This project is alpha}
|
14
|
+
|
15
|
+
s.rubyforge_project = "ask_stack"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency 'selenium-client', '>= 1.2.18'
|
23
|
+
end
|
data/bin/ask_stack
ADDED
data/lib/ask_stack.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'uri'
|
4
|
+
require 'iconv'
|
5
|
+
require 'date'
|
6
|
+
require 'selenium/client'
|
7
|
+
|
8
|
+
class AskStack
|
9
|
+
|
10
|
+
attr_accessor :url, :sel, :browser, :config
|
11
|
+
alias :page :browser
|
12
|
+
|
13
|
+
LOGIN_URL = 'http://stackoverflow.com/users/login'
|
14
|
+
|
15
|
+
def initialize(config)
|
16
|
+
@url = LOGIN_URL
|
17
|
+
@browser = Selenium::Client::Driver.new \
|
18
|
+
:host => "localhost",
|
19
|
+
:port => 4444,
|
20
|
+
:browser => "*firefox",
|
21
|
+
:url => @url,
|
22
|
+
:timeout_in_second => 60
|
23
|
+
browser.start_new_browser_session
|
24
|
+
browser.highlight_located_element=true
|
25
|
+
browser.set_browser_log_level 'debug'
|
26
|
+
@config = config
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
browser.window_maximize
|
31
|
+
login
|
32
|
+
page.click "nav-askquestion", :wait_for => :page
|
33
|
+
fill_form
|
34
|
+
sleep 3
|
35
|
+
submit
|
36
|
+
sleep 2
|
37
|
+
puts "You question is posted at this URL"
|
38
|
+
puts browser.get_location
|
39
|
+
stop
|
40
|
+
puts "Done"
|
41
|
+
end
|
42
|
+
|
43
|
+
def fill_form
|
44
|
+
puts "Filling in question form"
|
45
|
+
page.type "name=title", config[:question][:title]
|
46
|
+
page.focus 'name=post-text'
|
47
|
+
sleep 1
|
48
|
+
page.type "name=post-text", config[:question][:body]
|
49
|
+
page.type_keys "name=post-text", " "
|
50
|
+
sleep 1
|
51
|
+
page.type "name=tagnames", config[:question][:tags]
|
52
|
+
end
|
53
|
+
|
54
|
+
def submit
|
55
|
+
puts "Submitting"
|
56
|
+
page.click 'id=submit-button', :wait_for => :page
|
57
|
+
end
|
58
|
+
|
59
|
+
def login
|
60
|
+
browser.open url
|
61
|
+
puts "Signing in"
|
62
|
+
browser.run_script "openid.signin('google')"
|
63
|
+
puts "Loading Google signin"
|
64
|
+
browser.wait_for_page_to_load(7)
|
65
|
+
if !at_google_signin?
|
66
|
+
puts "Error: Not the Google signin page. Tomfoolery afoot."
|
67
|
+
exit
|
68
|
+
end
|
69
|
+
# TODO separate this Open ID provider signin to pluggable class
|
70
|
+
puts "On Google signin page. Signing into Google"
|
71
|
+
page.type "Email", config['username']
|
72
|
+
page.type "Passwd", config['password']
|
73
|
+
puts "Signing in..."
|
74
|
+
page.click "signIn", :wait_for => :page
|
75
|
+
end
|
76
|
+
|
77
|
+
def stop
|
78
|
+
browser.close
|
79
|
+
browser.stop
|
80
|
+
end
|
81
|
+
|
82
|
+
# http://stackoverflow.com/search/titles?like=what%20is%20the%20best%20way%20to%20test%20in%20ruby%3F&_=1303413037898
|
83
|
+
# returns html frag, see similar.txt
|
84
|
+
#
|
85
|
+
def similar_questions
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
# http://stackoverflow.com/filter/tags?callback=jQuery151044475735054025645_1303413170293&q=ruby&limit=6×tamp=1303413245025&_=1303413245028
|
90
|
+
# sample resp:
|
91
|
+
# http://stackoverflow.com/filter/tags?q=ruby&limit=6×tamp=1303413245025&_=1303413245028
|
92
|
+
#
|
93
|
+
# timestamp divide by 1000
|
94
|
+
#
|
95
|
+
# jQuery151044475735054025645_1303413170293("ruby|22235\nruby-on-rails|36488\nruby-on-rails-3|7173\nrubygems|1569\njruby|585\nruby-on-rails-plugins|495");[choi kaja~]$
|
96
|
+
def complete_tags
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
def self.run
|
102
|
+
config = YAML::load(File.read("ask_stack.yml"))
|
103
|
+
raw_question = STDIN.read.strip
|
104
|
+
title = raw_question.split(/^\s*$/)[0]
|
105
|
+
tags = raw_question.split(/^\s*$/)[-1]
|
106
|
+
body = raw_question.split(/^\s*$/)[1..-2].join("\n")
|
107
|
+
config[:question] = {title: title, body: body, tags: tags}
|
108
|
+
so = AskStack.new config
|
109
|
+
so.run
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def at_google_signin?
|
115
|
+
browser.get_location =~ %r{^https://www.google.com/accounts/ServiceLogin}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
if __FILE__ == $0
|
120
|
+
AskStack.run
|
121
|
+
end
|
122
|
+
|
data/similar.txt
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
<div class="system-alert">The question you're asking appears subjective and is likely to be closed.</div><label>Related Questions</label><div style="height:150px; overflow-y:scroll; overflow-x:clip;">
|
2
|
+
<div class="answer-summary"><a href="/questions/267237/whats-the-best-way-to-unit-test-protected-private-methods-in-ruby" title="28 votes"><div class="answer-votes default">28</div></a><div class="answer-link"style="width:90%"><a href="/questions/267237/whats-the-best-way-to-unit-test-protected-private-methods-in-ruby" class="question-hyperlink" title="What's the best way to unit test protected and private methods in Ruby, using the standard Ruby Test::Unit framework?
|
3
|
+
|
4
|
+
I'm sure somebody will pipe up and dogmatically assert that "you should only unit … ">What's the best way to unit test protected & private methods in Ruby?</a> <span title="11 answers">(11)</span></div>
|
5
|
+
</div>
|
6
|
+
<div class="answer-summary"><a href="/questions/4882822/whats-the-best-way-to-test-application-api-library-in-ruby" title="0 votes"><div class="answer-votes default">0</div></a><div class="answer-link"style="width:90%"><a href="/questions/4882822/whats-the-best-way-to-test-application-api-library-in-ruby" class="question-hyperlink" title="Hello everyone,
|
7
|
+
|
8
|
+
Im developing a ruby API library for some web application (not rails based).
|
9
|
+
Library (in short overview) consists of the following objects:
|
10
|
+
|
11
|
+
|
12
|
+
Client - main api class
|
13
|
+
Request - module … ">What's the best way to test application API library in Ruby?</a> <span title="1 answers">(1)</span></div>
|
14
|
+
</div>
|
15
|
+
<div class="answer-summary"><a href="/questions/5169706/what-is-the-best-way-to-develop-and-test-cache-in-a-ruby-on-rails-application" title="0 votes, with an accepted answer"><div class="answer-votes answered-accepted default">0</div></a><div class="answer-link"style="width:90%"><a href="/questions/5169706/what-is-the-best-way-to-develop-and-test-cache-in-a-ruby-on-rails-application" class="question-hyperlink" title="I am using Ruby on Rails 3 and I would like to start "to code" the cache system.
|
16
|
+
|
17
|
+
I am working on localhost in development mode. I heard that working in development mode it is possible to face some … ">What is the best way to develop and test cache in a Ruby on rails application?</a> <span title="1 answers">(1)</span></div>
|
18
|
+
</div>
|
19
|
+
<div class="answer-summary"><a href="/questions/2082970/whats-the-best-way-to-test-this" title="6 votes, with an accepted answer"><div class="answer-votes answered-accepted default">6</div></a><div class="answer-link"style="width:90%"><a href="/questions/2082970/whats-the-best-way-to-test-this" class="question-hyperlink" title="I'm going through the EdgeCase Ruby Koans. In about_dice_project.rb, there's a test called "test_dice_values_should_change_between_rolls", which is straightforward:
|
20
|
+
|
21
|
+
def … ">What's the best way to test this?</a> <span title="5 answers">(5)</span></div>
|
22
|
+
</div>
|
23
|
+
<div class="answer-summary"><a href="/questions/6806/what-is-the-best-way-to-learn-ruby" title="41 votes, with an accepted answer"><div class="answer-votes answered-accepted default">41</div></a><div class="answer-link"style="width:90%"><a href="/questions/6806/what-is-the-best-way-to-learn-ruby" class="question-hyperlink" title="How do I go about learning Ruby quickly and easily without buying expensive programming books?">What is the best way to learn Ruby?</a> <span title="30 answers">(30)</span></div>
|
24
|
+
</div>
|
25
|
+
<div class="answer-summary"><a href="/questions/274619/what-is-the-best-way-to-debug-a-nunit-test" title="7 votes"><div class="answer-votes default">7</div></a><div class="answer-link"style="width:90%"><a href="/questions/274619/what-is-the-best-way-to-debug-a-nunit-test" class="question-hyperlink" title="My platform: Visual C# 2008 Express Edition with NUnit 2.2.7
|
26
|
+
|
27
|
+
I have a solution with my code in one project and my NUnit unit tests in a different project in the same solution.
|
28
|
+
|
29
|
+
I have been struggling … ">What is the best way to debug a NUnit test?</a> <span title="6 answers">(6)</span></div>
|
30
|
+
</div>
|
31
|
+
<div class="answer-summary"><a href="/questions/367222/what-is-the-best-way-to-test-mailing-list-software" title="4 votes, with an accepted answer"><div class="answer-votes answered-accepted default">4</div></a><div class="answer-link"style="width:90%"><a href="/questions/367222/what-is-the-best-way-to-test-mailing-list-software" class="question-hyperlink" title="I recently wrote mailing list software in Ruby On Rails. I would like to get some expert advice on the best way to test it. For example, it would be cool if I could write a script generate 10,000 … ">What is the best way to test mailing list software?</a> <span title="3 answers">(3)</span></div>
|
32
|
+
</div>
|
33
|
+
<div class="answer-summary"><a href="/questions/400552/what-is-the-best-way-to-unit-test-an-asynchronous-method" title="8 votes, with an accepted answer"><div class="answer-votes answered-accepted default">8</div></a><div class="answer-link"style="width:90%"><a href="/questions/400552/what-is-the-best-way-to-unit-test-an-asynchronous-method" class="question-hyperlink" title="I can't seem to find a .NET answer to this problem, which I would have thought would be fairly common.
|
34
|
+
What is the best pattern for unit testing an asynchronous method?
|
35
|
+
|
36
|
+
Obviously I need to call the … ">What is the best way to unit test an asynchronous method?</a> <span title="3 answers">(3)</span></div>
|
37
|
+
</div>
|
38
|
+
<div class="answer-summary"><a href="/questions/411257/what-is-the-best-way-to-test-gwt-code" title="9 votes"><div class="answer-votes default">9</div></a><div class="answer-link"style="width:90%"><a href="/questions/411257/what-is-the-best-way-to-test-gwt-code" class="question-hyperlink" title="What is the best way to test GWT code?
|
39
|
+
|
40
|
+
GWTTestCase in hosted mode is too slow and none of the mocking frameworks work.
|
41
|
+
|
42
|
+
Currently we are following MVC as suggested in … ">What is the best way to test GWT code</a> <span title="4 answers">(4)</span></div>
|
43
|
+
</div>
|
44
|
+
<div class="answer-summary"><a href="/questions/620333/whats-the-best-way-to-test-wcf-services" title="14 votes, with an accepted answer"><div class="answer-votes answered-accepted default">14</div></a><div class="answer-link"style="width:90%"><a href="/questions/620333/whats-the-best-way-to-test-wcf-services" class="question-hyperlink" title="I've used this tool that microsoft ships with visual studio because it's quick and dirty
|
45
|
+
|
46
|
+
http://msdn.microsoft.com/en-us/library/bb552364.aspx
|
47
|
+
|
48
|
+
But it's kinda clunky and hard to work with. Are there … ">What's the best way to test WCF services?</a> <span title="8 answers">(8)</span></div>
|
49
|
+
</div>
|
50
|
+
<div class="answer-summary"><a href="/questions/762997/whats-the-best-way-to-test-an-atom-server" title="1 votes, with an accepted answer"><div class="answer-votes answered-accepted default">1</div></a><div class="answer-link"style="width:90%"><a href="/questions/762997/whats-the-best-way-to-test-an-atom-server" class="question-hyperlink" title="Hi all,
|
51
|
+
I'm setting up an Atom server to act as a REST-ful interface to my backend database.
|
52
|
+
|
53
|
+
I'd like to put together some tests to ensure:
|
54
|
+
- the output is Atom and AtomPub compliant
|
55
|
+
- the data … ">What's the best way to test an Atom Server?</a> <span title="1 answers">(1)</span></div>
|
56
|
+
</div>
|
57
|
+
<div class="answer-summary"><a href="/questions/4405650/mvccontrib-whats-the-best-way-to-test-xmlresult" title="0 votes, with an accepted answer"><div class="answer-votes answered-accepted default">0</div></a><div class="answer-link"style="width:90%"><a href="/questions/4405650/mvccontrib-whats-the-best-way-to-test-xmlresult" class="question-hyperlink" title="I am just getting going with MVCContrib. I have a controller action that returns an XMLResult. I would like write unit tests around the XMLResult. I have never used the MVCContrib's TestHelper. How … ">MVCContrib - What's the best way to test XMLResult?</a> <span title="1 answers">(1)</span></div>
|
58
|
+
</div>
|
59
|
+
<div class="answer-summary"><a href="/questions/4622620/what-is-the-best-way-to-test-a-rails-app" title="5 votes, with an accepted answer"><div class="answer-votes answered-accepted default">5</div></a><div class="answer-link"style="width:90%"><a href="/questions/4622620/what-is-the-best-way-to-test-a-rails-app" class="question-hyperlink" title="I am new to testing in Rails. I have decided to learn Test Driven Development and hence researching on how to go about it in rails.
|
60
|
+
|
61
|
+
I started out with Test::Unit and soon came to know that better … ">What is the best way to test a rails app?</a> <span title="3 answers">(3)</span></div>
|
62
|
+
</div>
|
63
|
+
<div class="answer-summary"><a href="/questions/47833/in-c-what-is-the-best-way-to-test-if-a-dataset-is-empty" title="5 votes, with an accepted answer"><div class="answer-votes answered-accepted default">5</div></a><div class="answer-link"style="width:90%"><a href="/questions/47833/in-c-what-is-the-best-way-to-test-if-a-dataset-is-empty" class="question-hyperlink" title="I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty?
|
64
|
+
">In C#, what is the best way to test if a dataset is empty?</a> <span title="6 answers">(6)</span></div>
|
65
|
+
</div>
|
66
|
+
<div class="answer-summary"><a href="/questions/147362/what-is-the-best-way-to-test-a-stored-procedure" title="9 votes, with an accepted answer"><div class="answer-votes answered-accepted default">9</div></a><div class="answer-link"style="width:90%"><a href="/questions/147362/what-is-the-best-way-to-test-a-stored-procedure" class="question-hyperlink" title="Like many companies that require all access be through stored procedures, we seem to have a lot of business logic locked away in sprocs. These things are just plain hard to test, and some of them … ">What is the best way to test a stored procedure?</a> <span title="7 answers">(7)</span></div>
|
67
|
+
</div>
|
68
|
+
<div class="answer-summary"><a href="/questions/3298147/whats-the-best-way-to-test-cross-browser-compatibility" title="1 votes, with an accepted answer"><div class="answer-votes answered-accepted default">1</div></a><div class="answer-link"style="width:90%"><a href="/questions/3298147/whats-the-best-way-to-test-cross-browser-compatibility" class="question-hyperlink" title="Since the portable versions of Internet Explorer are no longer supported (and never fully worked) I'm trying to find a way to test sites in a number of different browsers.
|
69
|
+
|
70
|
+
The lag on something like … ">What's the best way to test cross-browser compatibility?</a> <span title="4 answers">(4)</span></div>
|
71
|
+
</div>
|
72
|
+
<div class="answer-summary"><a href="/questions/39567/what-is-the-best-way-to-convert-an-array-to-a-hash-in-ruby" title="14 votes, with an accepted answer"><div class="answer-votes answered-accepted default">14</div></a><div class="answer-link"style="width:90%"><a href="/questions/39567/what-is-the-best-way-to-convert-an-array-to-a-hash-in-ruby" class="question-hyperlink" title="In Ruby, given an array in one of the following forms...
|
73
|
+
|
74
|
+
[apple, 1, banana, 2]
|
75
|
+
[[apple, 1], [banana, 2]]
|
76
|
+
|
77
|
+
|
78
|
+
...what is the best way to convert this into a hash in the form of...
|
79
|
+
|
80
|
+
{apple => 1, … ">What is the best way to convert an array to a hash in Ruby</a> <span title="6 answers">(6)</span></div>
|
81
|
+
</div>
|
82
|
+
<div class="answer-summary"><a href="/questions/67890/whats-the-best-way-to-hash-a-url-in-ruby" title="4 votes, with an accepted answer"><div class="answer-votes answered-accepted default">4</div></a><div class="answer-link"style="width:90%"><a href="/questions/67890/whats-the-best-way-to-hash-a-url-in-ruby" class="question-hyperlink" title="I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as … ">What's the best way to hash a url in ruby?</a> <span title="3 answers">(3)</span></div>
|
83
|
+
</div>
|
84
|
+
<div class="answer-summary"><a href="/questions/137605/what-is-the-best-way-to-parse-a-web-page-in-ruby" title="9 votes, with an accepted answer"><div class="answer-votes answered-accepted default">9</div></a><div class="answer-link"style="width:90%"><a href="/questions/137605/what-is-the-best-way-to-parse-a-web-page-in-ruby" class="question-hyperlink" title="I have been looking at XML and HTML libraries on rubyforge for a simple way to pull data out of a web page. For example if I want to parse a user page on stackoverflow how can I get the data into a … ">What is the best way to parse a web page in Ruby?</a> <span title="4 answers">(4)</span></div>
|
85
|
+
</div>
|
86
|
+
<div class="answer-summary"><a href="/questions/150731/what-is-the-best-way-to-write-to-a-file-in-ruby" title="4 votes, with an accepted answer"><div class="answer-votes answered-accepted default">4</div></a><div class="answer-link"style="width:90%"><a href="/questions/150731/what-is-the-best-way-to-write-to-a-file-in-ruby" class="question-hyperlink" title="I would like to write some data to a file in Ruby. What is the best way to do that?
|
87
|
+
">What is the best way to write to a file in Ruby?</a> <span title="5 answers">(5)</span></div>
|
88
|
+
</div>
|
89
|
+
<div class="answer-summary"><a href="/questions/471445/what-is-the-best-way-to-load-ruby-classes-into-an-application" title="5 votes, with an accepted answer"><div class="answer-votes answered-accepted default">5</div></a><div class="answer-link"style="width:90%"><a href="/questions/471445/what-is-the-best-way-to-load-ruby-classes-into-an-application" class="question-hyperlink" title="Currently I am loading Ruby classes into each class file using the require command, for example:
|
90
|
+
|
91
|
+
require File.join(File.dirname(__FILE__), 'observation_worker')
|
92
|
+
require … ">What is the best way to load Ruby classes into an application?</a> <span title="5 answers">(5)</span></div>
|
93
|
+
</div>
|
94
|
+
<div class="answer-summary"><a href="/questions/694547/what-is-the-best-way-for-having-a-ruby-service-on-rails" title="1 votes, with an accepted answer"><div class="answer-votes answered-accepted default">1</div></a><div class="answer-link"style="width:90%"><a href="/questions/694547/what-is-the-best-way-for-having-a-ruby-service-on-rails" class="question-hyperlink" title="I need to run a ruby-script as a service. The script needs access to the ActiveRecords of a rails-app.
|
95
|
+
|
96
|
+
What would be the best way? A rake task? How can it be started as a service on both windows and … ">What is the best way for having a ruby service on rails?</a> <span title="3 answers">(3)</span></div>
|
97
|
+
</div>
|
98
|
+
<div class="answer-summary"><a href="/questions/784943/what-is-the-best-way-to-remap-a-hash-in-ruby" title="2 votes, with an accepted answer"><div class="answer-votes answered-accepted default">2</div></a><div class="answer-link"style="width:90%"><a href="/questions/784943/what-is-the-best-way-to-remap-a-hash-in-ruby" class="question-hyperlink" title="Is there a simple way of remapping a hash in ruby the following way:
|
99
|
+
|
100
|
+
from:
|
101
|
+
|
102
|
+
{:name => "foo", :value => "bar"}
|
103
|
+
|
104
|
+
|
105
|
+
to:
|
106
|
+
|
107
|
+
{"foo" => "bar"}
|
108
|
+
|
109
|
+
|
110
|
+
Preferably in a way that makes it simple to do this … ">What is the best way to remap a Hash in Ruby?</a> <span title="3 answers">(3)</span></div>
|
111
|
+
</div>
|
112
|
+
<div class="answer-summary"><a href="/questions/880268/whats-the-best-way-in-ruby-to-average-sets-in-an-array" title="1 votes, with an accepted answer"><div class="answer-votes answered-accepted default">1</div></a><div class="answer-link"style="width:90%"><a href="/questions/880268/whats-the-best-way-in-ruby-to-average-sets-in-an-array" class="question-hyperlink" title="Given the following simple data set, what is the best way to average the values for the sets 0 25 53 and 80.
|
113
|
+
|
114
|
+
[["0", "148.5"],
|
115
|
+
["0", "146.5"],
|
116
|
+
["0", "148.6"],
|
117
|
+
["0", "202.3"],
|
118
|
+
["25", … ">What's the best way in Ruby to average sets in an array?</a> <span title="2 answers">(2)</span></div>
|
119
|
+
</div>
|
120
|
+
</div>
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ask_stack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel Choi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-21 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: selenium-client
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.2.18
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: This project is alpha
|
28
|
+
email:
|
29
|
+
- dhchoi@gmail.com
|
30
|
+
executables:
|
31
|
+
- ask_stack
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- ask_stack.gemspec
|
41
|
+
- bin/ask_stack
|
42
|
+
- lib/ask_stack.rb
|
43
|
+
- similar.txt
|
44
|
+
- vendor/selenium-server-standalone-2.0b3.jar
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: https://github.com/danchoi/ask_stack
|
47
|
+
licenses: []
|
48
|
+
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.9.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
requirements: []
|
67
|
+
|
68
|
+
rubyforge_project: ask_stack
|
69
|
+
rubygems_version: 1.6.1
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: Post questions to StackOverflow from the unix command line
|
73
|
+
test_files: []
|
74
|
+
|