Skip to content

Instantly share code, notes, and snippets.

@jrecursive
Created May 4, 2014 21:12
Show Gist options
  • Select an option

  • Save jrecursive/16df788693dd2569f54e to your computer and use it in GitHub Desktop.

Select an option

Save jrecursive/16df788693dd2569f54e to your computer and use it in GitHub Desktop.
create circuit test;
use test;
create channel ch1;
create channel ch2;
create channel metrics;
create channel tweets;
create device tweeter-1 as tweeter {"filters":[ "putin", "ukraine", "crimea", "russia", "kiev", "ukranian", "russian", "odessa", "slovyansk" ]};
create device tweet-channel as channeler {"channel":"tweets"};
create wire tweet-wire from tweeter-1.tweets to tweet-channel.data;
create device tw-users as json-path {"path":"$.tweet.screen_name_s"};
create device tw-users-lru as lru {"field":"value"};
create wire w-tw-users from tw-users.value to tw-users-lru.data;
create device tw-media as json-path {"path":"$.media[0].media_url_ss"};
create device tw-media-lru as lru {"field":"value", "media":true};
create wire w-tw-ctry from tw-media.value to tw-media-lru.data;
create device tw-tags as json-path {"path":"$.tweet.hashtags_s_mv"};
create device expander-2 as array-expander;
create device tw-tags-lru as lru {"field":"value"};
create wire w-tw-tags from tw-tags.value to expander-2.in;
create wire w-tw-tags-1 from expander-2.out to tw-tags-lru.data;
create device tw-urls as json-path {"path":"$.urls"};
create device expander-1 as array-expander;
create device tw-urls-1 as json-path {"path":"$.value.expanded_url_tt"};
create device tw-urls-lru as lru {"field":"value"};
create wire w-tw-urls-1 from tw-urls.value to expander-1.in;
create wire w-tw-urls-2 from expander-1.out to tw-urls-1.data;
create wire w-tw-urls-3 from tw-urls-1.value to tw-urls-lru.data;
create device tw-geo as json-path {"path":"$..geo_ll"};
create device tw-geo-expander as array-expander;
create device tw-geo-lru as lru {"field":"value"};
create wire tw-geo-w-0 from tw-geo.value to tw-geo-expander.in;
create wire w-tw-geo-3b from tw-geo-expander.out to tw-geo-lru.data;
create device map-1 as google-map;
create wire w-tw-geo-4 from tw-geo-expander.out to map-1.in;
create wire w-0 from tweeter-1.tweets to tw-users.data;
create wire w-0 from tweeter-1.tweets to tw-users.data;
create wire w-1 from tweeter-1.tweets to tw-media.data;
create wire w-2 from tweeter-1.tweets to tw-tags.data;
create wire w-3 from tweeter-1.tweets to tw-urls.data;
create wire w-4 from tweeter-1.tweets to tw-geo.data;
alter device map-1 set {"refresh-hz": 0.5};
alter circuit test set {"refresh-hz": 7.0};
alter device tw-media-lru set {"media":true, "refresh-hz":1.0};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment