a = 'sea'
URI("https://music.yandex.ru/search?text=#{a}")
#=> #<URI::HTTPS https://music.yandex.ru/search?text=sea>
uri = URI('https://music.yandex.ru/search')
params = { :text => 'пятница' }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
a = {'a'=>'n'}
a.to_json #=> Валидная строка в формате json
class MyHash < Hash
def foo_value?
has_value? 'foo'
end
end
a = MyHash.new
a[:a] = 'foo'
b = MyHash.new
b[:a] = 'baz'
p a.foo_value?
p b.foo_value?
doc = Nokogiri::HTML('<body><span class="title">Название:</span> Rising Water - James Vincent McMorrow<span></span><body>')
name = doc.xpath('//span/following-sibling::text()[1]').text
p name # => " Rising Water - James Vincent McMorrow"
SuperGem::SuperAR::SuperModel
curl -d "key1=value1&key2=value2" "uri"
"facebook_token[url]=https:\//www.facebook.com\/dialog\/oauth?client_id=123456&redirec_uri=blablabla"
распарсилась на два параметра (facebook_token[url]
и redirec_uri
)facebook_token[url]
и facebook_token[client_id]
. $.ajax({
url: 'https://api.vk.com/method/database.getCities?',
data: {
country_id: "1",
q: "Санкт"
},
type: 'GET',
dataType: 'jsonp',
success: function(data) {
console.log(data.response[0])
}
})