This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="span-17 colborder" id="content" > | |
[% USE Filter.HTMLScrubber %] | |
[% FOREACH entry IN feed.entries %] | |
<h2 class="loud alt"><a href="[% entry.link | url | html %]">[% entry.title | html %]</h2></a> | |
<div class="alt"> | |
[% entry.content.body | |
| html_scrubber(['-span','+p','+h3','+h4','+ol','+ul','+li','+strong','+em','-style','-script', '-iframe']) | |
| remove('style=".*?"' ) | |
| remove('class=".*?"' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use v6; | |
class obj { | |
has $.attr is rw = 42; | |
has @.shallow = 1,2,3; | |
has @.deep = [1,2,3],[4,5,6]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use v6; | |
say "Part 1 (first square number with 5 distinct digits)"; | |
for (100..10_000) -> $i { my $j=$i**2; "$i -> $j".say && last if $j.comb.unique.elems==5 }; | |
say "\nPart 2 (Rankings)"; | |
# Imagine a running race - times of the runners are: | |
my @times= 10, 5, 10, 15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# 12.1 | |
my @primes = lazy (2,3,*+2 ... ∞).grep: *.is-prime; | |
# from wikipedia: https://en.wikipedia.org/wiki/Euclid_number | |
# Write a script that finds the smallest Euclid Number that is not prime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# Challenge #13.1 | |
# Write a script to print the date of last Friday of every month of a given year. Order y, m, d | |
my $year=2019; | |
for 1..12 -> $month { | |
my $d=Date.new($year,$month,1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# challenge 14.1 | |
# Write a script to generate Van Eck’s sequence. | |
my @testEck=0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5; | |
is vanEck(17),@testEck,"First 18 items Van Eck's sequence correct"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# 15.1 Write a script to generate first 10 strong and weak prime numbers. | |
# | |
# For example, the nth prime number is represented by p(n). | |
# | |
# p(1) = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# 15.1 Write a script to generate first 10 strong and weak prime numbers. | |
# | |
# For example, the nth prime number is represented by p(n). | |
# | |
# p(1) = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# 15.2 | |
# Write a script to implement Vigenère cipher. The script should be able encode and decode. https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher | |
#| Encodes or Decodes a text using Vigenère cipher. | |
multi sub MAIN(Str $text , Str $key, Bool :$encode=True, Bool :$decode=False) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
use v6; | |
use Test; | |
# 16.1 | |
# Pythagoras Pie Puzzle, proposed by Jo Christian Oterhals. | |
# | |
# At a party a pie is to be shared by 100 guest. The first guest gets 1% of the pie, the second guest gets 2% of the remaining pie, the third gets 3% of the remaining pie, the fourth gets 4% and so on. | |
# |
OlderNewer