Skip to content

Instantly share code, notes, and snippets.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@zlu
zlu / Questions
Created August 11, 2011 11:32
Frozen Rails Give-away
Day job:
Your Rails contributions (if any):
What's your Ruby/Rail experience?:
How do you use GitHub?:
require 'rubygems'
require 'eventmachine'
module DigitCollector
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
p ">>>you sent: #{data}"
"**********"
{"query"=>{"results"=>{"result"=>{"value"=>"got some data here"}}, "uri"=>"http://query.yahooapis.com/v1/yql?q=SELECT+*+FROM+yql.storage+WHERE+name+%3D+%27store%3A%2F%2FLymM4H0i9TI0FgdrLZlAE1%27", "diagnostics"=>{"build-version"=>"3130", "publiclyCallable"=>"true", "user-time"=>"34", "service-time"=>"31"}, "count"=>"1", "lang"=>"en-US", "updated"=>Thu Sep 10 11:24:04 UTC 2009, "created"=>Thu Sep 10 11:24:04 UTC 2009}}
"**********"
{"query"=>{"results"=>{"success"=>"Updated store://jQhfGRIErjcVVzd4wOY2nj"}, "uri"=>"http://query.yahooapis.com/v1/yql?q=UPDATE+yql.storage+SET+value%3D%27%7B%22apples%22%3A%22green%22%2C%22bananas%22%3A%22yellow%22%7D%27+WHERE+name+%3D+%27store%3A%2F%2Fk02azLQDF27kArKxszngfx%27", "diagnostics"=>{"build-version"=>"3130", "publiclyCallable"=>"true", "user-time"=>"65", "service-time"=>"64"}, "count"=>"1", "lang"=>"en-US", "updated"=>Thu Sep 10 11:24:04 UTC 2009, "created"=>Thu Sep 10 11:24:04 UTC 2009}}
"**********"
{"query"=>{"results"=>{"result"=>{"value"=>{"bananas"=>"
require 'rubygems'
require 'eventmachine'
module DigitCollector
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
p ">>>you sent: #{data}"
require 'rubygems'
require 'curb'
curl = Curl::Easy.new 'http://sandite.orl.voxeo.net/transcribe'
curl.userpwd = 'username:password'
#voxeon:orlandorox
curl.multipart_form_post = true
curl.http_post Curl::PostField.file('filename', ARGV[0]),
Curl::PostField.content('transcriptionOutFormat', 'json'),
transcribe(mp3source, { :transcriptionOutURI => resulturi })
#Post script
require 'rubygems'
require 'open-uri'
require 'cgi'
require 'net/http'
require 'mime/types'
#Module sprinkling in Multipart for net/http
module Multipart
answer
wait 1000
result = record("Please leave your message at the beep",{'beep'=>true, :silenceTimeout=> 8, :maxTime=>30,:timeout=>5.03456789})
log "recorded " + result.recordURI.to_s
require 'open-uri'
uri = URI.encode(result.recordURI)
opened = open(uri, :http_basic_authentication => ["", ""])
read = opened.read
log "downloaded"