You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by sa...@apache.org on 2016/02/08 23:56:41 UTC

incubator-apex-site git commit: APEXCORE-333 Adding dynamially loaded meetups via meetup.com API to Apex announcements page

Repository: incubator-apex-site
Updated Branches:
  refs/heads/master 04ea81829 -> b93b3e6fa


APEXCORE-333 Adding dynamially loaded meetups via meetup.com API to Apex announcements page


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/commit/b93b3e6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/tree/b93b3e6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/diff/b93b3e6f

Branch: refs/heads/master
Commit: b93b3e6fa6f3e2019d1ce49e54e528449d91ba29
Parents: 04ea818
Author: sashadt <sa...@datatorrent.com>
Authored: Mon Feb 8 14:56:31 2016 -0800
Committer: sashadt <sa...@datatorrent.com>
Committed: Mon Feb 8 14:56:31 2016 -0800

----------------------------------------------------------------------
 README.md                  | 76 +++++++++++++++++++++++++++++++++++++++++
 src/md/upcoming-meetups.md | 26 ++++++++++++--
 2 files changed, 99 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-site/blob/b93b3e6f/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 14487df..42f55e5 100644
--- a/README.md
+++ b/README.md
@@ -139,3 +139,79 @@ git commit -m 'Updating roadmap'
 
 Once changes have been committed, follow the regular site publishing steps to update and publish `roadmap.html`.
 
+
+Updating Announcements Page
+---------------------------
+
+Announcement updates are added to announcements.md file.
+
+Upcoming meetups are automatically generated by a widget which uses meetup.com API to load all the events with apache-apex topic.  Additional events can be added directly to upcoming-meetups.md file.
+
+To update the widget, or change the topic, go to the [Meetup Widget Foundry]http://www.meetup.com/meetup_api/foundry/, select Meetup Group Stats widget editable section, and paste the following code:
+
+```html
+<html>
+<head>
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
+<script src="local.js"></script>
+<script src="api_key.js"></script>
+<script id="config" type="text/javascript" charset="utf-8">
+  var $parameters = {
+    topic: "apache-apex",
+    width: 250,
+    height: 1000,
+  };
+  var $queries = {
+    events: function() {
+      return mup_widget.api_call("/2/open_events", {topic: $parameters.topic, page: '20'});
+    }
+  };
+</script>
+<link rel="stylesheet" type="text/css" href="https://a248.e.akamai.net/secure.meetupstatic.com/style/widget.css">
+<script type="text/javascript" charset="utf-8">
+  mup_widget.with_jquery(function($, ctx) {
+    var group = '',
+        months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
+        addLink = function(content, link) {
+            return '<a target="_blank" href="' + link + '">' + content + '</a>';
+        },
+        addLeadingZero = function( num ) {
+            return (num < 10) ? ('0' + num) : num;
+          },
+        getFormattedDate = function( millis ) {
+            var date = new Date( millis );
+            return  months[date.getMonth()] + ' ' + addLeadingZero( date.getDate() ) + ', ' + date.getFullYear().toString();
+          };
+
+    $.getJSON($queries.events(), function(data) {
+      if (data.status && data.status.match(/^200/) == null) {
+        console.log("Error loading Meetups events: ", data.status + ": " + data.details);
+      } else {
+          if (data.results.length > 0) {
+              for (var i = 0; i < data.results.length; i++) {
+                var event = data.results[i];
+                console.log(event);
+                var venue = event.venue;
+                console.log(venue);
+                var city = (venue && venue.city) ? venue.city : 'TBD';
+                var state_country = (venue) ?  venue.state || venue.country : '' ;
+                var location = (state_country) ? city + ", " + state_country.toUpperCase() : city;
+                $('.next-events', ctx).append('<p>'+ addLink(getFormattedDate(event.time) + " - " + location, event.event_url) + " - " + event.name + "</p>");
+              }
+            }
+      }
+    });
+
+  });
+</script>
+</head>
+<body>
+  <div class="next-events"></div>
+</body>
+</html>
+```
+
+The generated widget code can be directly pasted into upcoming-meetups.md page.
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-apex-site/blob/b93b3e6f/src/md/upcoming-meetups.md
----------------------------------------------------------------------
diff --git a/src/md/upcoming-meetups.md b/src/md/upcoming-meetups.md
index e186e86..b943fe5 100644
--- a/src/md/upcoming-meetups.md
+++ b/src/md/upcoming-meetups.md
@@ -1,5 +1,25 @@
 ## Upcoming Meetups
 
-[San Francisco, CA - Feb 16, 2016](http://www.meetup.com/Data-Mining/events/228420836/) - Open Source Tools for Data Science (Apex for Dimensions Computation)
-[Sunnyvale, CA - Feb 17, 2016](http://www.meetup.com/hadoop/events/228573587/) - Bay Area Hadoop User Group - Apache Apex (incubating): Stream Processing Architecture and Applications
-[San Jose, CA - Feb 25, 2016](http://www.meetup.com/Apex-Bay-Area-Chapter/events/228539962/) - Enterprise-grade streaming under 2ms on Hadoop; Integrating Apex with Nifi
\ No newline at end of file
+[Feb 16, 2016 - San Francisco, CA](http://www.meetup.com/Data-Mining/events/228420836/) - Open Source Tools for Data Science (Apex for Dimensions Computation)
+
+[Feb 17, 2016 - Sunnyvale, CA](http://www.meetup.com/hadoop/events/228573587/) - Bay Area Hadoop User Group - Apache Apex (incubating): Stream Processing Architecture and Applications
+
+
+<div id="1454971182612"></div>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+<script>jQuery.noConflict();</script>
+<script>
+  jQuery(function() {
+    var scripts = ["var%20%24parameters%20%3D%20%7B%22topic%22%3A%22apache-apex%22%2C%22width%22%3A%22250%22%2C%22height%22%3A%221000%22%7D%3B%0Avar%20%24queries%20%3D%20%7B%20events%3A%20function%28%29%20%7B%20return%20%22https%3A//api.meetup.com/2/open_events%3Fand_text%3DFalse%26offset%3D0%26format%3Djson%26limited_events%3DFalse%26sig%3D5cc475b2c28e785d85c0ae29356f71dbb7c85839%26topic%3Dapache-apex%26callback%3D%3F%26page%3D20%26radius%3D25.0%26sig_id%3D87819142%26desc%3DFalse%26status%3Dupcoming%26_%3D1454971181894%26user_agent%3Dmeetup.widget%3Amug_stats%22%3B%20%7D%20%7D%3B%0A","%0Amup_widget.with_jquery%28function%28%24%2Cctx%29%7Bvar%20group%3D%27%27%2Cmonths%3D%5B%27Jan%27%2C%27Feb%27%2C%27Mar%27%2C%27Apr%27%2C%27May%27%2C%27Jun%27%2C%27Jul%27%2C%27Aug%27%2C%27Sep%27%2C%27Oct%27%2C%27Nov%27%2C%27Dec%27%5D%2CaddLink%3Dfunction%28content%2Clink%29%7Breturn%27%3Ca%20target%3D%22_blank%22%20href%3D%22%27+link+%27%22%3E%27+content+%27%3C/a%3E%27%3B%7D%2CaddLeadingZero%3Dfunctio
 n%28num%29%7Breturn%28num%3C10%29%3F%28%270%27+num%29%3Anum%3B%7D%2CgetFormattedDate%3Dfunction%28millis%29%7Bvar%20date%3Dnew%20Date%28millis%29%3Breturn%20months%5Bdate.getMonth%28%29%5D+%27%20%27+addLeadingZero%28date.getDate%28%29%29+%27%2C%20%27+date.getFullYear%28%29.toString%28%29%3B%7D%3B%24.getJSON%28%24queries.events%28%29%2Cfunction%28data%29%7Bif%28data.status%26%26data.status.match%28/%5E200/%29%3D%3Dnull%29%7Bconsole.log%28%22Error%20loading%20Meetups%20events%3A%20%22%2Cdata.status+%22%3A%20%22+data.details%29%3B%7Delse%7Bif%28data.results.length%3E0%29%7Bfor%28var%20i%3D0%3Bi%3Cdata.results.length%3Bi++%29%7Bvar%20event%3Ddata.results%5Bi%5D%3Bconsole.log%28event%29%3Bvar%20venue%3Devent.venue%3Bconsole.log%28venue%29%3Bvar%20city%3D%28venue%26%26venue.city%29%3Fvenue.city%3A%27TBD%27%3Bvar%20state_country%3D%28venue%29%3Fvenue.state%7C%7Cvenue.country%3A%27%27%3Bvar%20location%3D%28state_country%29%3Fcity+%22%2C%20%22+state_country.toUpperCase%28%29%3Acity%3B%24%28%
 27.next-events%27%2Cctx%29.append%28%27%3Cp%3E%27+addLink%28getFormattedDate%28event.time%29+%22%20-%20%22+location%2Cevent.event_url%29+%22%20-%20%22+event.name+%22%3C/p%3E%22%29%3B%7D%7D%7D%7D%29%3B%7D%29%3B"];
+    jQuery("#1454971182612").append(unescape("%3Clink%20rel%3D%22stylesheet%22%20type%3D%22text/css%22%20href%3D%22https%3A//a248.e.akamai.net/secure.meetupstatic.com/style/widget.css%22/%3E%0A%0A%3C/head%3E%3Cdiv%20class%3D%22next-events%22%3E%3C/div%3E"));
+    var mup_widget = {
+      with_jquery: function(block) {
+        block(jQuery, document.getElementById("1454971182612"));
+      }
+    };
+    for (i in scripts) { eval(unescape(scripts[i])) }
+  });
+</script>
+
+
+[Propose additional meetup ideas in one of the Apache Apex groups!](http://apache-apex.meetup.com/)
\ No newline at end of file