you are in: codestackercodes [RSS] → tag: json [RSS]

show flickr photos with javascript Delicious Email

show/hide lines
   1  <script type="text/javascript">
   2  function jsonFlickrFeed(o){
   3  	var i = 0;
   4  	while(o.items[i]){
   5      	document.write('<img src="' + o.items[i].media.m + '" alt="' + o.items[i].title +'">');
   6     		i++;
   7  	}
   8  }
   9  </script>
  10  <script src="http://api.flickr.com/services/feeds/photos_public.gne?id=28203925@N08&lang=en-us&format=json" type="text/javascript"></script>
created by leozera — 07 September 2008 — get a short url — tags: flickr javascript json embed

Traduz textos usando o google Delicious Email

Traduz palavras/frases/textos usando a API do Google, usei aqui http://github.com/rafaelss/shoes-translator

show/hide lines
   1  require 'rest_client'
   2  require 'json'
   3  require 'cgi'
   4  
   5  word = CGI.escape("hello world")
   6  response = RestClient.get "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=#{word}&langpair=en%7Cpt"
   7  json = JSON.parse(response)
   8  status = json['responseStatus']
   9  if status == 200
  10      puts json['responseData']['translatedText']
  11  else
  12      puts "(#{responseStatus}) erro ao traduzir #{word}"
  13  end
created by rafaess — 03 July 2008 — get a short url — tags: api google json rest ruby tradutor embed