Skip to content

Instantly share code, notes, and snippets.

@runemadsen
Forked from lilyszajn/High Five Ruby App
Created October 24, 2011 19:00
Show Gist options
  • Save runemadsen/1309828 to your computer and use it in GitHub Desktop.
Save runemadsen/1309828 to your computer and use it in GitHub Desktop.
High Five Ruby app with jquery
require 'rubygems'
require 'sinatra'
require 'open-uri'
get "/highFive.jsonp" do
content_type :jsonp
open("http://www.itpcakemix.com/project/HI5SON!!").read
end
get "/" do
<<-CRAZYKAT
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.4.2.min.js" ></script>
<script>
var apikey = "2794b427c3570f8b21835f18368f407a"
var photoid = "results.doc.photoid"
var flickrUrl = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key="+ apikey+"&photo_id="+ "photoid" +"&format=json&jsoncallback=?"
$(window).load(function () {
/*$.getJSONP("/~lrs372/highFive/highFive.jsonp", function(data)){
for( var i = 0; i < data.rows.length){
var photoid = data.rows[i].doc.photoid;
$.getJSON(flickrUrl, function(data) {
result = data.rows[0]; })
// console.log(data.sizes.size[3].source);
console.log(data);
//console.log(results.doc)
addy = data.sizes.size[3].source
$('#photos').html('<img src = "' + addy + '"/>');
});
}*/
/*});
$.getJSON(flickrUrl, function(data){
result = data.rows[0]; })
// console.log(data.sizes.size[3].source);
console.log(data);
//console.log(results.doc)
//var results = data.rows;
// for(i data.rows) */
addy = data.sizes.size[3].source
$('#photos').html('<img src = "' + addy + '"/>');
});
}); */
</script>
</head>
<body>
<h1>Results</h1>
<div id="photos">
</div>
</body>
</html>
CRAZYKAT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment