seed r683 - trunk/examples
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r683 - trunk/examples
- Date: Thu, 8 Jan 2009 08:35:43 +0000 (UTC)
Author: racarr
Date: Thu Jan 8 08:35:43 2009
New Revision: 683
URL: http://svn.gnome.org/viewvc/seed?rev=683&view=rev
Log:
Funny example of GIO + JSON to pretty print the reddit home page.
Added:
trunk/examples/json-reddit.js (contents, props changed)
Added: trunk/examples/json-reddit.js
==============================================================================
--- (empty file)
+++ trunk/examples/json-reddit.js Thu Jan 8 08:35:43 2009
@@ -0,0 +1,18 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("Gio");
+var redditurl = Gio.file_new_for_uri("http://reddit.com/.json");
+var reddit = JSON.parse(redditurl.read().get_contents());
+
+stories = reddit.data.children;
+
+for (i in stories)
+{
+ var story = stories[i].data;
+ Seed.print("======");
+ Seed.print(story.ups + "/" +
+ story.downs + " " +
+ story.title + " (" +
+ story.domain +")" );
+ Seed.print(story.author);
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]