diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-08-17 06:12:51 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-08-17 06:12:51 +0100 |
| commit | 46ee69aabfaa3c9549b9254d3d253c28a0d96c91 (patch) | |
| tree | a13bbef9e08b6a91f96a184fd7ff8fb2693f16aa | |
| parent | ec5563f624bec6c302622c020496644d28d0b26f (diff) | |
| download | perlweeklychallenge-club-46ee69aabfaa3c9549b9254d3d253c28a0d96c91.tar.gz perlweeklychallenge-club-46ee69aabfaa3c9549b9254d3d253c28a0d96c91.tar.bz2 perlweeklychallenge-club-46ee69aabfaa3c9549b9254d3d253c28a0d96c91.zip | |
- Added solutions by Guillermo Ramos.
| -rw-r--r-- | challenge-021/guillermo-ramos/perl5/ch-1.pl | 19 | ||||
| -rw-r--r-- | challenge-021/guillermo-ramos/perl5/ch-2.pl | 62 | ||||
| -rw-r--r-- | stats/pwc-current.json | 207 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 60 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 384 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 844 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 72 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 256 |
11 files changed, 1084 insertions, 988 deletions
diff --git a/challenge-021/guillermo-ramos/perl5/ch-1.pl b/challenge-021/guillermo-ramos/perl5/ch-1.pl new file mode 100644 index 0000000000..86b5ef3e22 --- /dev/null +++ b/challenge-021/guillermo-ramos/perl5/ch-1.pl @@ -0,0 +1,19 @@ +#!/usr/bin/env perl +# +# Write a script to calculate the value of e, also known as Euler’s number and +# Napier’s constant. Please checkout wiki page for more information. +################################################################################ + +use strict; +use warnings; + +my $ITERS = shift or die "Usage: $0 <iterations>"; + +my $e = 1; +my $denom = 1; +foreach my $i (1 .. $ITERS) { + $denom *= $i; + $e += 1/$denom; +} + +print "$e\n"; diff --git a/challenge-021/guillermo-ramos/perl5/ch-2.pl b/challenge-021/guillermo-ramos/perl5/ch-2.pl new file mode 100644 index 0000000000..a3970a2c7a --- /dev/null +++ b/challenge-021/guillermo-ramos/perl5/ch-2.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +# +# Write a script for URL normalization based on rfc3986 +# +# According to Wikipedia, URL normalization is the process by which URLs are +# modified and standardized in a consistent manner. The goal of the +# normalization process is to transform a URL into a normalized URL so it is +# possible to determine if two syntactically different URLs may be equivalent. +# +# (https://en.wikipedia.org/wiki/URL_normalization). +################################################################################ + +use strict; +use warnings; + +my $url = shift or die "Usage: $0 <url>\n"; + +my $scheme_re = qr<([hH][tT][tT][pP][sS]?)>; +my $ipv4_re = qr<(?:[0-9]{1,3}\.){3}[0-9]{1,3}>; +my $hostname_re = qr<[a-zA-Z0-9.\-]+>; +my $host_re = qr<($ipv4_re|$hostname_re)>; +my $port_re = qr<(?::([0-9]+))?>; +my $rest_re = qr<([a-zA-Z0-9/\-._~\?=&%#]*)>; + +# Capitalizing letters in escape sequences +$url =~ s<%[a-zA-Z0-9]{2}>< uc($&) >ge; + +sub decode_octet { + my $octet = shift; + my $hex = hex(substr($octet, 1, length($octet))); + if (grep /^$hex$/, map ord, 'a'..'z', 'A'..'Z', '0'..'9', qw<- . _ ~>) { + return chr($hex); + } else { + return $octet; + } +} + +# Decoding percent-encoded octets of unreserved characters +$url =~ s<%[a-zA-Z0-9]{2}>< decode_octet($&) >ge; + +my ($scheme, $host, $port, $path) = $url =~ + m<^$scheme_re://$host_re$port_re$rest_re>; + +die "Unable to decode URI" unless $scheme and $host; + +# Converting the scheme and host to lower case +$scheme = lc($scheme); +$host = lc($host); + +# Removing the default port +if (!$port || $scheme eq 'http' && $port == 80 || $scheme eq 'https' && $port == 443) { + $port = ''; +} else { + $port = ":$port"; +} + +# Removing dot-segments +$path =~ s</\./|/\.$></>g; # Remove all '.' +$path =~ s</[^/]+/\.\.><>g; # Remove instances of the pattern: '/x/..' +$path =~ s<(\.\./)+><>g; # Remove all '..'s left at the beginning + +print "$scheme://$host$port$path\n"; diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 32cf7cd7e5..ff0c912522 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,44 +1,96 @@ { - "tooltip" : { - "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } } }, - "xAxis" : { - "type" : "category" - }, - "subtitle" : { - "text" : "[Champions: 9] Last updated at 2019-08-17 05:07:46 GMT" - }, + "series" : [ + { + "name" : "Perl Weekly Challenge - 021", + "colorByPoint" : 1, + "data" : [ + { + "name" : "Andrezgz", + "drilldown" : "Andrezgz", + "y" : 2 + }, + { + "name" : "Dave Cross", + "drilldown" : "Dave Cross", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { + "name" : "Duane Powell", + "drilldown" : "Duane Powell", + "y" : 2 + }, + { + "name" : "E. Choroba", + "drilldown" : "E. Choroba", + "y" : 2 + }, + { + "name" : "Guillermo Ramos", + "y" : 2, + "drilldown" : "Guillermo Ramos" + }, + { + "name" : "Laurent Rosenfeld", + "drilldown" : "Laurent Rosenfeld", + "y" : 5 + }, + { + "name" : "Roger Bell West", + "drilldown" : "Roger Bell West", + "y" : 4 + }, + { + "y" : 1, + "drilldown" : "Simon Proctor", + "name" : "Simon Proctor" + }, + { + "name" : "Steven Wilson", + "drilldown" : "Steven Wilson", + "y" : 1 + } + ] + } + ], "drilldown" : { "series" : [ { - "name" : "Andrezgz", "data" : [ [ "Perl 5", 2 ] ], + "name" : "Andrezgz", "id" : "Andrezgz" }, { + "id" : "Dave Cross", + "name" : "Dave Cross", "data" : [ [ "Perl 5", 2 ] - ], - "id" : "Dave Cross", - "name" : "Dave Cross" + ] }, { "id" : "Dave Jacoby", + "name" : "Dave Jacoby", "data" : [ [ "Perl 5", @@ -48,32 +100,39 @@ "Blog", 1 ] - ], - "name" : "Dave Jacoby" + ] }, { "id" : "Duane Powell", + "name" : "Duane Powell", + "data" : [ + [ + "Perl 5", + 2 + ] + ] + }, + { "data" : [ [ "Perl 5", 2 ] ], - "name" : "Duane Powell" + "name" : "E. Choroba", + "id" : "E. Choroba" }, { - "id" : "E. Choroba", + "name" : "Guillermo Ramos", "data" : [ [ "Perl 5", 2 ] ], - "name" : "E. Choroba" + "id" : "Guillermo Ramos" }, { - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld", "data" : [ [ "Perl 5", @@ -87,11 +146,11 @@ "Blog", 1 ] - ] + ], + "name" : "Laurent Rosenfeld", + "id" : "Laurent Rosenfeld" }, { - "name" : "Roger Bell West", - "id" : "Roger Bell West", "data" : [ [ "Perl 5", @@ -105,11 +164,13 @@ "Blog", 1 ] - ] + ], + "name" : "Roger Bell West", + "id" : "Roger Bell West" }, { - "name" : "Simon Proctor", "id" : "Simon Proctor", + "name" : "Simon Proctor", "data" : [ [ "Perl 6", @@ -118,86 +179,40 @@ ] }, { + "id" : "Steven Wilson", "name" : "Steven Wilson", "data" : [ [ "Perl 5", 1 ] - ], - "id" : "Steven Wilson" + ] } ] }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 + "yAxis" : { + "title" : { + "text" : "Total Solutions" } }, - "chart" : { - "type" : "column" + "xAxis" : { + "type" : "category" }, - "title" : { - "text" : "Perl Weekly Challenge - 021" + "tooltip" : { + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "followPointer" : 1 }, - "series" : [ - { - "name" : "Perl Weekly Challenge - 021", - "data" : [ - { - "name" : "Andrezgz", - "y" : 2, - "drilldown" : "Andrezgz" - }, - { - "drilldown" : "Dave Cross", - "name" : "Dave Cross", - "y" : 2 - }, - { - "y" : 2, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" - }, - { - "drilldown" : "Duane Powell", - "y" : 2, - "name" : "Duane Powell" - }, - { - "drilldown" : "E. Choroba", - "name" : "E. Choroba", - "y" : 2 - }, - { - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld", - "y" : 5 - }, - { - "drilldown" : "Roger Bell West", - "y" : 4, - "name" : "Roger Bell West" - }, - { - "y" : 1, - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor" - }, - { - "drilldown" : "Steven Wilson", - "y" : 1, - "name" : "Steven Wilson" - } - ], - "colorByPoint" : 1 - } - ], "legend" : { "enabled" : 0 + }, + "title" : { + "text" : "Perl Weekly Challenge - 021" + }, + "chart" : { + "type" : "column" + }, + "subtitle" : { + "text" : "[Champions: 10] Last updated at 2019-08-17 05:12:32 GMT" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 17edc211e7..68d8549c56 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,21 +1,34 @@ { "subtitle" : { - "text" : "Last updated at 2019-08-17 05:08:04 GMT" + "text" : "Last updated at 2019-08-17 05:12:44 GMT" }, - "title" : { - "text" : "Perl Weekly Challenge Contributions - 2019" + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, "xAxis" : { - "type" : "category", "labels" : { "style" : { "fontSize" : "13px", "fontFamily" : "Verdana, sans-serif" } - } + }, + "type" : "category" + }, + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : "false" }, "series" : [ { + "name" : "Contributions", "data" : [ [ "Blog", @@ -23,7 +36,7 @@ ], [ "Perl 5", - 862 + 864 ], [ "Perl 6", @@ -31,33 +44,20 @@ ] ], "dataLabels" : { - "y" : 10, - "enabled" : "true", - "align" : "right", - "rotation" : -90, - "format" : "{point.y:.0f}", "color" : "#FFFFFF", + "y" : 10, "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "name" : "Contributions" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "rotation" : -90, + "align" : "right", + "enabled" : "true", + "format" : "{point.y:.0f}" + } } ], - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "legend" : { - "enabled" : "false" - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "chart" : { - "type" : "column" + "title" : { + "text" : "Perl Weekly Challenge Contributions - 2019" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 2fafdb9a98..9688f4e45a 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -2,12 +2,155 @@ "chart" : { "type" : "column" }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } + }, + "title" : { + "text" : "Perl Weekly Challenge Language" + }, + "series" : [ + { + "colorByPoint" : "true", + "name" : "Perl Weekly Challenge Languages", + "data" : [ + { + "y" : 123, + "drilldown" : "001", + "name" : "#001" + }, + { + "y" : 104, + "drilldown" : "002", + "name" : "#002" + }, + { + "y" : 66, + "name" : "#003", + "drilldown" : "003" + }, + { + "y" : 84, + "drilldown" : "004", + "name" : "#004" + }, + { + "y" : 66, + "name" : "#005", + "drilldown" : "005" + }, + { + "y" : 47, + "drilldown" : "006", + "name" : "#006" + }, + { + "name" : "#007", + "drilldown" : "007", + "y" : 54 + }, + { + "y" : 67, + "name" : "#008", + "drilldown" : "008" + }, + { + "y" : 65, + "name" : "#009", + "drilldown" : "009" + }, + { + "y" : 58, + "name" : "#010", + "drilldown" : "010" + }, + { + "name" : "#011", + "drilldown" : "011", + "y" : 77 + }, + { + "y" : 81, + "drilldown" : "012", + "name" : "#012" + }, + { + "drilldown" : "013", + "name" : "#013", + "y" : 74 + }, + { + "y" : 94, + "name" : "#014", + "drilldown" : "014" + }, + { + "y" : 90, + "name" : "#015", + "drilldown" : "015" + }, + { + "name" : "#016", + "drilldown" : "016", + "y" : 64 + }, + { + "drilldown" : "017", + "name" : "#017", + "y" : 77 + }, + { + "y" : 73, + "drilldown" : "018", + "name" : "#018" + }, + { + "name" : "#019", + "drilldown" : "019", + "y" : 92 + }, + { + "name" : "#020", + "drilldown" : "020", + "y" : 89 + }, + { + "y" : 23, + "name" : "#021", + "drilldown" : "021" + } + ] + } + ], "legend" : { "enabled" : "false" }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "tooltip" : { + "followPointer" : "true", + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style=\"font-size:11px\"></span>" + }, + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-08-17 05:12:44 GMT" + }, "drilldown" : { "series" : [ { + "name" : "001", + "id" : "001", "data" : [ [ "Perl 5", @@ -21,13 +164,9 @@ "Blog", 10 ] - ], - "id" : "001", - "name" : "001" + ] }, { - "name" : "002", - "id" : "002", "data" : [ [ "Perl 5", @@ -41,11 +180,11 @@ "Blog", 9 ] - ] + ], + "name" : "002", + "id" : "002" }, { - "id" : "003", - "name" : "003", "data" : [ [ "Perl 5", @@ -59,9 +198,13 @@ "Blog", 8 ] - ] + ], + "id" : "003", + "name" : "003" }, { + "name" : "004", + "id" : "004", "data" : [ [ "Perl 5", @@ -75,11 +218,11 @@ "Blog", 9 ] - ], - "name" : "004", - "id" : "004" + ] }, { + "id" : "005", + "name" : "005", "data" : [ [ "Perl 5", @@ -93,13 +236,9 @@ "Blog", 11 ] - ], - "id" : "005", - "name" : "005" + ] }, { - "name" : "006", - "id" : "006", "data" : [ [ "Perl 5", @@ -113,7 +252,9 @@ "Blog", 6 ] - ] + ], + "id" : "006", + "name" : "006" }, { "data" : [ @@ -134,8 +275,8 @@ "name" : "007" }, { - "id" : "008", "name" : "008", + "id" : "008", "data" : [ [ "Perl 5", @@ -152,8 +293,8 @@ ] }, { - "id" : "009", "name" : "009", + "id" : "009", "data" : [ [ "Perl 5", @@ -170,8 +311,8 @@ ] }, { - "name" : "010", "id" : "010", + "name" : "010", "data" : [ [ "Perl 5", @@ -188,8 +329,6 @@ ] }, { - "id" : "011", - "name" : "011", "data" : [ [ "Perl 5", @@ -203,11 +342,11 @@ "Blog", 8 ] - ] + ], + "id" : "011", + "name" : "011" }, { - "id" : "012", - "name" : "012", "data" : [ [ "Perl 5", @@ -221,7 +360,9 @@ "Blog", 9 ] - ] + ], + "name" : "012", + "id" : "012" }, { "data" : [ @@ -238,10 +379,12 @@ 11 ] ], - "name" : "013", - "id" : "013" + "id" : "013", + "name" : "013" }, { + "id" : "014", + "name" : "014", "data" : [ [ "Perl 5", @@ -255,11 +398,11 @@ "Blog", 13 ] - ], - "name" : "014", - "id" : "014" + ] }, { + "name" : "015", + "id" : "015", "data" : [ [ "Perl 5", @@ -273,9 +416,7 @@ "Blog", 12 ] - ], - "name" : "015", - "id" : "015" + ] }, { "data" : [ @@ -292,12 +433,10 @@ 10 ] ], - "name" : "016", - "id" : "016" + "id" : "016", + "name" : "016" }, { - "name" : "017", - "id" : "017", "data" : [ [ "Perl 5", @@ -311,9 +450,13 @@ "Blog", 10 ] - ] + ], + "id" : "017", + "name" : "017" }, { + "id" : "018", + "name" : "018", "data" : [ [ "Perl 5", @@ -327,11 +470,11 @@ "Blog", 11 ] - ], - "name" : "018", - "id" : "018" + ] }, { + "name" : "019", + "id" : "019", "data" : [ [ "Perl 5", @@ -345,13 +488,11 @@ "Blog", 10 ] - ], - "name" : "019", - "id" : "019" + ] }, { - "id" : "020", "name" : "020", + "id" : "020", "data" : [ [ "Perl 5", @@ -368,12 +509,10 @@ ] }, { - "id" : "021", - "name" : "021", "data" : [ [ "Perl 5", - 14 + 16 ], [ "Perl 6", @@ -383,149 +522,10 @@ "Blog", 3 ] - ] + ], + "name" : "021", + "id" : "021" } ] - }, - "tooltip" : { - "followPointer" : "true", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style=\"font-size:11px\"></span>" - }, - "xAxis" : { - "type" : "category" - }, - "series" : [ - { - "data" : [ - { - "y" : 123, - "drilldown" : "001", - "name" : "#001" - }, - { - "drilldown" : "002", - "name" : "#002", - "y" : 104 - }, - { - "y" : 66, - "drilldown" : "003", - "name" : "#003" - }, - { - "y" : 84, - "name" : "#004", - "drilldown" : "004" - }, - { - "name" : "#005", - "drilldown" : "005", - "y" : 66 - }, - { - "drilldown" : "006", - "name" : "#006", - "y" : 47 - }, - { - "y" : 54, - "name" : "#007", - "drilldown" : "007" - }, - { - "y" : 67, - "drilldown" : "008", - "name" : "#008" - }, - { - "y" : 65, - "drilldown" : "009", - "name" : "#009" - }, - { - "drilldown" : "010", - "name" : "#010", - "y" : 58 - }, - { - "drilldown" : "011", - "name" : "#011", - "y" : 77 - }, - { - "name" : "#012", - "drilldown" : "012", - "y" : 81 - }, - { - "y" : 74, - "name" : "#013", - "drilldown" : "013" - }, - { - "y" : 94, - "drilldown" : "014", - "name" : "#014" - }, - { - "drilldown" : "015", - "name" : "#015", - "y" : 90 - }, - { - "y" : 64, - "drilldown" : "016", - "name" : "#016" - }, - { - "name" : "#017", - "drilldown" : "017", - "y" : 77 - }, - { - "drilldown" : "018", - "name" : "#018", - "y" : 73 - }, - { - "y" : 92, - "name" : "#019", - "drilldown" : "019" - }, - { - "drilldown" : "020", - "name" : "#020", - "y" : 89 - }, - { - "name" : "#021", - "drilldown" : "021", - "y" : 21 - } - ], - "name" : "Perl Weekly Challenge Languages", - "colorByPoint" : "true" - } - ], - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "title" : { - "text" : "Perl Weekly Challenge Language" - }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-08-17 05:08:04 GMT" } } diff --git a/stats/pwc-leaders.json b/stats/pwc-leaders.json index 4a4a505bd7..a6ec192ca1 100644 --- a/stats/pwc-leaders.json +++ b/stats/pwc-leaders.json @@ -1,29 +1,317 @@ { + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "title" : { + "text" : "Perl Weekly Challenge Leaders (TOP 50)" + }, + "subtitle" : { + "text" : "Click the columns to drilldown the score breakdown. Last updated at 2019-08-17 05:12:41 GMT" + }, + "chart" : { + "type" : "column" + }, "xAxis" : { "type" : "category" }, + "yAxis" : { + "title" : { + "text" : "Total Score" + } + }, + "series" : [ + { + "data" : [ + { + "drilldown" : "Laurent Rosenfeld", + "name" : "#1: Laurent Rosenfeld", + "y" : 218 + }, + { + "drilldown" : "Joelle Maslak", + "name" : "#2: Joelle Maslak", + "y" : 216 + }, + { + "drilldown" : "Jaldhar H. Vyas", + "y" : 172, + "name" : "#3: Jaldhar H. Vyas" + }, + { + "drilldown" : "Ruben Westerberg", + "name" : "#4: Ruben Westerberg", |
