aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2019-10-28 23:28:18 +0800
committerYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2019-10-28 23:28:18 +0800
commit969523ec870cd60e49219eee455ec5bca22f60e5 (patch)
treef0877671348c3a39f3475eeb62c5048d52c600bd
parent0b94465535c2e5d5bf31022cf583b021add9fd59 (diff)
parent20f13bc3f77dcc532de961cbd0bb470fb8625d66 (diff)
downloadperlweeklychallenge-club-969523ec870cd60e49219eee455ec5bca22f60e5.tar.gz
perlweeklychallenge-club-969523ec870cd60e49219eee455ec5bca22f60e5.tar.bz2
perlweeklychallenge-club-969523ec870cd60e49219eee455ec5bca22f60e5.zip
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
-rw-r--r--challenge-032/lars-balker/perl5/ch-1.pl22
-rw-r--r--challenge-032/lars-balker/perl5/ch-2.pl28
-rw-r--r--challenge-032/simon-proctor/perl6/ch-2.p67
-rw-r--r--stats/pwc-current.json86
-rw-r--r--stats/pwc-language-breakdown-summary.json86
-rw-r--r--stats/pwc-language-breakdown.json526
-rw-r--r--stats/pwc-leaders.json870
-rw-r--r--stats/pwc-summary-1-30.json96
-rw-r--r--stats/pwc-summary-121-150.json30
-rw-r--r--stats/pwc-summary-31-60.json110
-rw-r--r--stats/pwc-summary-61-90.json114
-rw-r--r--stats/pwc-summary-91-120.json36
-rw-r--r--stats/pwc-summary.json318
13 files changed, 1207 insertions, 1122 deletions
diff --git a/challenge-032/lars-balker/perl5/ch-1.pl b/challenge-032/lars-balker/perl5/ch-1.pl
new file mode 100644
index 0000000000..32bc6524ec
--- /dev/null
+++ b/challenge-032/lars-balker/perl5/ch-1.pl
@@ -0,0 +1,22 @@
+use warnings;
+use strict;
+
+my $csv = @ARGV && $ARGV[0] eq '-csv';
+shift if $csv;
+
+my %words;
+my $maxlength = 0;
+while (<>) {
+ chomp;
+ ++$words{$_};
+ $maxlength = length if length > $maxlength;
+}
+
+for my $word (sort { $words{$b} <=> $words{$a} || $a cmp $b } keys %words) {
+ if ($csv) {
+ printf "%s,%d\n", $word, $words{$word};
+ }
+ else {
+ printf "%-*s %4d\n", $maxlength, $word, $words{$word};
+ }
+}
diff --git a/challenge-032/lars-balker/perl5/ch-2.pl b/challenge-032/lars-balker/perl5/ch-2.pl
new file mode 100644
index 0000000000..81e9b616f3
--- /dev/null
+++ b/challenge-032/lars-balker/perl5/ch-2.pl
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+my $hashes = 24;
+
+my $data = { apple => 3, cherry => 2, banana => 1 };
+generate_bar_graph($data);
+print "\n";
+generate_bar_graph($data,1);
+
+sub generate_bar_graph {
+ my $data = shift;
+ my $order_by_label = shift;
+
+ my ($sum, $maxlength) = (0, 0);
+ for my $word (keys %$data) {
+ $maxlength = length($word) if length($word) > $maxlength;
+ $sum += $data->{$word};
+ }
+
+ my $sort = $order_by_label
+ ? sub { $a cmp $b }
+ : sub { $data->{$b} <=> $data->{$a} || $a cmp $b };
+ for my $word (sort $sort keys %$data) {
+ my $pct = $data->{$word} / $sum;
+ printf "%*s | %s\n", $maxlength, $word,
+ "#" x int($hashes * $pct);
+ }
+}
diff --git a/challenge-032/simon-proctor/perl6/ch-2.p6 b/challenge-032/simon-proctor/perl6/ch-2.p6
index 6e497adf27..0022fd7e2b 100644
--- a/challenge-032/simon-proctor/perl6/ch-2.p6
+++ b/challenge-032/simon-proctor/perl6/ch-2.p6
@@ -66,7 +66,12 @@ sub get-bar( Int $available, $max, $value ) {
}
sub get-screen-width() {
- run("tput","cols",:out).out.slurp.chomp;
+ my $result;
+ try {
+ $result = run("tput","cols",:out).out.slurp.chomp;
+ }
+ # Fallback incase tput not available
+ return $result || 100;
}
sub parse-space-sep( Str $line ) {
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 13cf2f3a67..af0eb8bde9 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,42 +1,53 @@
{
- "chart" : {
- "type" : "column"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "title" : {
- "text" : "Perl Weekly Challenge - 032"
+ "tooltip" : {
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
+ "followPointer" : 1,
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>"
},
"drilldown" : {
"series" : [
{
- "name" : "Dave Cross",
"data" : [
[
"Perl 5",
2
]
],
+ "name" : "Dave Cross",
"id" : "Dave Cross"
},
{
- "id" : "Simon Proctor",
- "name" : "Simon Proctor",
+ "name" : "Lars Balker",
+ "id" : "Lars Balker",
+ "data" : [
+ [
+ "Perl 5",
+ 2
+ ]
+ ]
+ },
+ {
"data" : [
[
"Perl 6",
+ 2
+ ]
+ ],
+ "id" : "Simon Proctor",
+ "name" : "Simon Proctor"
+ },
+ {
+ "name" : "Yet Ebreo",
+ "id" : "Yet Ebreo",
+ "data" : [
+ [
+ "Perl 5",
1
]
]
}
]
},
- "subtitle" : {
- "text" : "[Champions: 2] Last updated at 2019-10-28 13:59:57 GMT"
- },
"plotOptions" : {
"series" : {
"borderWidth" : 0,
@@ -49,30 +60,49 @@
"xAxis" : {
"type" : "category"
},
- "legend" : {
- "enabled" : 0
+ "title" : {
+ "text" : "Perl Weekly Challenge - 032"
},
- "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
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "chart" : {
+ "type" : "column"
},
"series" : [
{
+ "colorByPoint" : 1,
"data" : [
{
"y" : 2,
- "drilldown" : "Dave Cross",
- "name" : "Dave Cross"
+ "name" : "Dave Cross",
+ "drilldown" : "Dave Cross"
+ },
+ {
+ "drilldown" : "Lars Balker",
+ "name" : "Lars Balker",
+ "y" : 2
},
{
- "y" : 1,
"drilldown" : "Simon Proctor",
+ "y" : 2,
"name" : "Simon Proctor"
+ },
+ {
+ "drilldown" : "Yet Ebreo",
+ "name" : "Yet Ebreo",
+ "y" : 1
}
],
- "name" : "Perl Weekly Challenge - 032",
- "colorByPoint" : 1
+ "name" : "Perl Weekly Challenge - 032"
}
- ]
+ ],
+ "subtitle" : {
+ "text" : "[Champions: 4] Last updated at 2019-10-28 15:17:45 GMT"
+ },
+ "legend" : {
+ "enabled" : 0
+ }
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 96dc67fa16..27aab499ae 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,43 +1,6 @@
{
- "chart" : {
- "type" : "column"
- },
- "legend" : {
- "enabled" : "false"
- },
- "xAxis" : {
- "type" : "category",
- "labels" : {
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- }
- }
- },
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
- },
- "yAxis" : {
- "title" : {
- "text" : null
- },
- "min" : 0
- },
"series" : [
{
- "dataLabels" : {
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- },
- "y" : 10,
- "align" : "right",
- "format" : "{point.y:.0f}",
- "enabled" : "true",
- "color" : "#FFFFFF",
- "rotation" : -90
- },
- "name" : "Contributions",
"data" : [
[
"Blog",
@@ -45,19 +8,56 @@
],
[
"Perl 5",
- 1306
+ 1309
],
[
"Perl 6",
- 779
+ 780
]
- ]
+ ],
+ "dataLabels" : {
+ "rotation" : -90,
+ "color" : "#FFFFFF",
+ "y" : 10,
+ "enabled" : "true",
+ "style" : {
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
+ },
+ "align" : "right",
+ "format" : "{point.y:.0f}"
+ },
+ "name" : "Contributions"
}
],
- "title" : {
- "text" : "Perl Weekly Challenge Contributions - 2019"
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
+ },
+ "xAxis" : {
+ "type" : "category",
+ "labels" : {
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ }
+ }
+ },
+ "legend" : {
+ "enabled" : "false"
},
"subtitle" : {
- "text" : "Last updated at 2019-10-28 14:00:04 GMT"
+ "text" : "Last updated at 2019-10-28 15:17:51 GMT"
+ },
+ "yAxis" : {
+ "title" : {
+ "text" : null
+ },
+ "min" : 0
+ },
+ "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 2d6dc26095..467040d1e8 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,208 +1,21 @@
{
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-10-28 14:00:04 GMT"
- },
"title" : {
"text" : "Perl Weekly Challenge Language"
},
- "series" : [
- {
- "data" : [
- {
- "drilldown" : "001",
- "name" : "#001",
- "y" : 132
- },
- {
- "y" : 104,
- "name" : "#002",
- "drilldown" : "002"
- },
- {
- "name" : "#003",
- "drilldown" : "003",
- "y" : 67
- },
- {
- "y" : 86,
- "drilldown" : "004",
- "name" : "#004"
- },
- {
- "y" : 66,
- "drilldown" : "005",
- "name" : "#005"
- },
- {
- "drilldown" : "006",
- "name" : "#006",
- "y" : 48
- },
- {
- "y" : 56,
- "drilldown" : "007",
- "name" : "#007"
- },
- {
- "name" : "#008",
- "drilldown" : "008",
- "y" : 70
- },
- {
- "y" : 68,
- "drilldown" : "009",
- "name" : "#009"
- },
- {
- "y" : 60,
- "name" : "#010",
- "drilldown" : "010"
- },
- {
- "y" : 78,
- "name" : "#011",
- "drilldown" : "011"
- },
- {
- "name" : "#012",
- "drilldown" : "012",
- "y" : 83
- },
- {
- "y" : 76,
- "drilldown" : "013",
- "name" : "#013"
- },
- {
- "drilldown" : "014",
- "name" : "#014",
- "y" : 96
- },
- {
- "y" : 93,
- "drilldown" : "015",
- "name" : "#015"
- },
- {
- "y" : 66,
- "drilldown" : "016",
- "name" : "#016"
- },
- {
- "drilldown" : "017",
- "name" : "#017",
- "y" : 79
- },
- {
- "name" : "#018",
- "drilldown" : "018",
- "y" : 76
- },
- {
- "y" : 95,
- "drilldown" : "019",
- "name" : "#019"
- },
- {
- "drilldown" : "020",
- "name" : "#020",
- "y" : 95
- },
- {
- "y" : 67,
- "name" : "#021",
- "drilldown" : "021"
- },
- {
- "name" : "#022",
- "drilldown" : "022",
- "y" : 63
- },
- {
- "y" : 91,
- "drilldown" : "023",
- "name" : "#023"
- },
- {
- "name" : "#024",
- "drilldown" : "024",
- "y" : 70
- },
- {
- "name" : "#025",
- "drilldown" : "025",
- "y" : 55
- },
- {
- "drilldown" : "026",
- "name" : "#026",
- "y" : 70
- },
- {
- "name" : "#027",
- "drilldown" : "027",
- "y" : 58
- },
- {
- "drilldown" : "028",
- "name" : "#028",
- "y" : 78
- },
- {
- "name" : "#029",
- "drilldown" : "029",
- "y" : 76
- },
- {
- "drilldown" : "030",
- "name" : "#030",
- "y" : 114
- },
- {
- "y" : 84,
- "name" : "#031",
- "drilldown" : "031"
- },
- {
- "drilldown" : "032",
- "name" : "#032",
- "y" : 3
- }
- ],
- "colorByPoint" : "true",
- "name" : "Perl Weekly Challenge Languages"
- }
- ],
+ "chart" : {
+ "type" : "column"
+ },
+ "subtitle" : {
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-10-28 15:17:51 GMT"
+ },
"yAxis" : {
"title" : {
"text" : "Total Solutions"
}
},
- "tooltip" : {
- "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
- "headerFormat" : "<span style=\"font-size:11px\"></span>",
- "followPointer" : "true"
- },
- "plotOptions" : {
- "series" : {
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- },
- "borderWidth" : 0
- }
- },
- "xAxis" : {
- "type" : "category"
- },
- "legend" : {
- "enabled" : "false"
- },
"drilldown" : {
"series" : [
{
- "id" : "001",
- "name" : "001",
"data" : [
[
"Perl 5",
@@ -216,9 +29,13 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "001",
+ "id" : "001"
},
{
+ "id" : "002",
+ "name" : "002",
"data" : [
[
"Perl 5",
@@ -232,9 +49,7 @@
"Blog",
9
]
- ],
- "id" : "002",
- "name" : "002"
+ ]
},
{
"data" : [
@@ -255,7 +70,6 @@
"id" : "003"
},
{
- "name" : "004",
"id" : "004",
"data" : [
[
@@ -270,9 +84,12 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "004"
},
{
+ "id" : "005",
+ "name" : "005",
"data" : [
[
"Perl 5",
@@ -286,12 +103,9 @@
"Blog",
11
]
- ],
- "id" : "005",
- "name" : "005"
+ ]
},
{
- "name" : "006",
"id" : "006",
"data" : [
[
@@ -306,11 +120,12 @@
"Blog",
7
]
- ]
+ ],
+ "name" : "006"
},
{
- "name" : "007",
"id" : "007",
+ "name" : "007",
"data" : [
[
"Perl 5",
@@ -327,6 +142,8 @@
]
},
{
+ "id" : "008",
+ "name" : "008",
"data" : [
[
"Perl 5",
@@ -340,11 +157,10 @@
"Blog",
12
]
- ],
- "id" : "008",
- "name" : "008"
+ ]
},
{
+ "id" : "009",
"data" : [
[
"Perl 5",
@@ -359,12 +175,9 @@
13
]
],
- "id" : "009",
"name" : "009"
},
{
- "name" : "010",
- "id" : "010",
"data" : [
[
"Perl 5",
@@ -378,11 +191,11 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "010",
+ "id" : "010"
},
{
- "id" : "011",
- "name" : "011",
"data" : [
[
"Perl 5",
@@ -396,7 +209,9 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "011",
+ "id" : "011"
},
{
"id" : "012",
@@ -417,6 +232,7 @@
]
},
{
+ "name" : "013",
"data" : [
[
"Perl 5",
@@ -431,12 +247,10 @@
13
]
],
- "id" : "013",
- "name" : "013"
+ "id" : "013"
},
{
"name" : "014",
- "id" : "014",
"data" : [
[
"Perl 5",
@@ -450,11 +264,11 @@
"Blog",
15
]
- ]
+ ],
+ "id" : "014"
},
{
"id" : "015",
- "name" : "015",
"data" : [
[
"Perl 5",
@@ -468,7 +282,8 @@
"Blog",
15
]
- ]
+ ],
+ "name" : "015"
},
{
"data" : [
@@ -490,7 +305,6 @@
},
{
"id" : "017",
- "name" : "017",
"data" : [
[
"Perl 5",
@@ -504,9 +318,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "017"
},
{
+ "name" : "018",
"data" : [
[
"Perl 5",
@@ -521,10 +337,11 @@
14
]
],
- "id" : "018",
- "name" : "018"
+ "id" : "018"
},
{
+ "id" : "019",
+ "name" : "019",
"data" : [
[
"Perl 5",
@@ -538,11 +355,10 @@
"Blog",
13
]
- ],
- "id" : "019",
- "name" : "019"
+ ]
},
{
+ "name" : "020",
"data" : [
[
"Perl 5",
@@ -557,8 +373,7 @@
13
]
],
- "id" : "020",
- "name" : "020"
+ "id" : "020"
},
{
"data" : [
@@ -575,10 +390,11 @@
10
]
],
- "id" : "021",
- "name" : "021"
+ "name" : "021",
+ "id" : "021"
},
{
+ "id" : "022",
"data" : [
[
"Perl 5",
@@ -593,12 +409,10 @@
10
]
],
- "name" : "022",
- "id" : "022"
+ "name" : "022"
},
{
"name" : "023",
- "id" : "023",
"data" : [
[
"Perl 5",
@@ -612,7 +426,8 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "023"
},
{
"data" : [
@@ -629,12 +444,10 @@
11
]
],
- "id" : "024",
- "name" : "024"
+ "name" : "024",
+ "id" : "024"
},
{
- "name" : "025",
- "id" : "025",
"data" : [
[
"Perl 5",
@@ -648,11 +461,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "025",
+ "id" : "025"
},
{
- "name" : "026",
- "id" : "026",
"data" : [
[
"Perl 5",
@@ -666,11 +479,12 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "026",
+ "id" : "026"
},
{
"id" : "027",
- "name" : "027",
"data" : [
[
"Perl 5",
@@ -684,11 +498,12 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "027"
},
{
- "name" : "028",
"id" : "028",
+ "name" : "028",
"data" : [
[
"Perl 5",
@@ -706,7 +521,6 @@
},
{
"id" : "029",
- "name" : "029",
"data" : [
[
"Perl 5",
@@ -720,9 +534,12 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "029"
},
{
+ "id" : "030",
+ "name" : "030",
"data" : [
[
"Perl 5",
@@ -736,11 +553,11 @@
"Blog",
9
]
- ],
- "id" : "030",
- "name" : "030"
+ ]
},
{
+ "id" : "031",
+ "name" : "031",
"data" : [
[
"Perl 5",
@@ -754,31 +571,214 @@
"Blog",
6
]
- ],
- "name" : "031",
- "id" : "031"
+ ]
},
{
- "name" : "032",
- "id" : "032",
"data" : [
[
"Perl 5",
- 2
+ 5
],
[
"Perl 6",
- 1
+ 2
],
[
"Blog",
0
]
- ]
+ ],
+ "name" : "032",
+ "id" : "032"
}
]
},
- "chart" : {
- "type" : "column"
- }
+ "legend" : {
+ "enabled" : "false"
+ },
+ "tooltip" : {
+ "headerFormat" : "<span style=\"font-size:11px\"></span>",
+ "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
+ "followPointer" : "true"
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "plotOptions" : {
+ "series" : {
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ },
+ "borderWidth" : 0
+ }
+ },
+ "series" : [
+ {
+ "data" : [
+ {
+ "name" : "#001",
+ "drilldown" : "001",
+ "y" : 132
+ },
+ {
+ "drilldown" : "002",
+ "name" : "#002",
+ "y" : 104
+ },
+ {
+ "y" : 67,
+ "drilldown" : "003",
+ "name" : "#003"
+ },
+ {
+ "drilldown" : "004",
+ "name" : "#004",
+ "y" : 86
+ },
+ {
+ "y" : 66,
+ "name" : "#005",
+ "drilldown" : "005"
+ },
+ {
+ "name" : "#006",
+ "drilldown" : "006",
+ "y" : 48
+ },
+ {
+ "y" : 56,
+ "drilldown" : "007",
+ "name" : "#007"
+ },
+ {
+ "y" : 70,
+ "name" : "#008",
+ "drilldown" : "008"
+ },
+ {
+ "y" : 68,
+ "drilldown" : "009",
+ "name" : "#009"
+ },
+ {
+ "drilldown" : "010",
+ "name" : "#010",
+ "y" : 60
+ },
+ {
+ "name" : "#011",
+ "drilldown" : "011",
+ "y" : 78
+ },
+ {
+ "name" : "#012",
+ "drilldown" : "012",
+ "y" : 83
+ },
+ {
+ "y" : 76,
+ "drilldown" : "013",
+ "name" : "#013"
+ },
+ {
+ "y" : 96,
+ "drilldown" : "014",
+ "name" : "#014"
+ },
+ {
+ "y" : 93,
+ "drilldown" : "015",
+ "name" : "#015"
+ },
+ {
+ "drilldown" : "016",
+ "name" : "#016",
+ "y" : 66
+ },
+ {
+ "drilldown" : "017",
+ "name" : "#017",
+ "y" : 79
+ },
+ {
+ "y" : 76,
+ "name" : "#018",
+ "drilldown" : "018"
+ },
+ {
+ "drilldown" : "019",
+ "name" : "#019",
+ "y" : 95
+ },
+ {
+ "name" : "#020",
+ "drilldown" : "020",
+ "y" : 95
+ },
+ {
+ "y" : 67,
+ "drilldown" : "021",
+ "name" : "#021"
+ },
+ {
+ "y" : 63,
+ "drilldown" : "022",
+ "name" : "#022"
+ },
+ {
+ "drilldown" : "023",
+ "name" : "#023",
+ "y" : 91
+ },
+ {
+ "name" : "#024",
+ "drilldown" : "024",
+ "y" : 70
+ },
+ {
+ "y" : 55,
+ "name" : "#025",
+ "drilldown" : "025"
+ },
+ {
+ "y" : 70,
+ "name" : "#026",
+ "drilldown" : "026"
+ },
+ {
+ "name" : "#027",
+ "drilldown" : "027",
+ "y" : 58
+ },
+ {
+ "name" : "#028",
+ "drilldown" : "028",
+ "y" : 78
+ },
+ {