You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/04/12 22:46:51 UTC

[whimsy] 02/02: Test file for experiments

This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit f0d5917d5ba7f74e4bb8b6bcff634db88985e1ce
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Wed Apr 12 18:46:44 2017 -0400

    Test file for experiments
---
 www/test/test.cgi | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/www/test/test.cgi b/www/test/test.cgi
new file mode 100644
index 0000000..573bd98
--- /dev/null
+++ b/www/test/test.cgi
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+# Test file for various experiments
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
+require 'csv'
+require 'json'
+require 'whimsy/asf'
+require 'wunderbar'
+require 'wunderbar/bootstrap'
+require 'net/http'
+require 'whimsy/asf/themes'
+
+PAGETITLE = 'Listing of Apache Registered Trademarks'
+CSVFILE = "/Users/curcuru/src/foundation/Brand/trademark-registrations.csv"
+docket = CSV.read(CSVFILE, headers:true)
+docketcols = %w[ Mark Jurisdiction Class ]
+# Map Mark names to PMC identifiers (only openoffice.org so far)
+docket.each do |r|
+  r << ['pmc', r['Mark'].downcase.sub('.org','').sub(' & design','')]
+end
+dockethash = {}
+
+# Create hash based on pmc with aggregated data
+docket.each do |r|
+  key = r['pmc'].to_sym
+  if dockethash.key?(key)
+    # Aggregate specific values
+    docketcols.each do |col|
+      dockethash[key][col] |= [r[col]]
+    end
+
+  else
+    # Create first copy of the pmc
+    dockethash[key] = {}
+    docketcols.each do |col|
+      dockethash[key][col] = [r[col]]
+    end
+    # Hack: only use first Goods
+    dockethash[key]['Goods'] = r['Goods']
+  end
+end
+
+puts JSON.pretty_generate(dockethash)

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.