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 Cro::HTTP::Client; | |
use HTML::Parser::XML; | |
my $client = Cro::HTTP::Client.new; | |
my $url-channel = Channel.new; | |
$url-channel.send: 'http://rabidgravy.com/'; |
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 | |
my Str @roles = ("Blogger" , "Unemployed" , "Storyfinder" , "Filmmaker" , "Communicator" , "Performer" , "Sculptor" , "Writer" , "Editor" , "Mastermind" , "Crossfitter" , "Academic" , "Educator" , "Consultant" , "Author" , "Dreamer" , "Dancer" , "Volunteer" , "Fan" , "Geek" , "Community Volunteer" , "Runner" , "Hiker" , "Feminist" , "Journalist" , "Photographer" , "Accountant" , "Alcoholic" , "Innovator" , "Disrupter" , "Chef" , "Gambler" , "Believer" , "Achiever" , "Lawyer" , "Doctor" , "Restauranteur" , "Philanthropist" , "Researcher" , "Foodie" , "Snowboarder" , "Humanitarian" , "Citizen" , "Redhead" , "Curator" , "Compiler" , "Contributor" , "Singer" , "Songwriter" , "Olympian" , "Learner" , "Musician" , "Fisherman" , "Stylist" , "Producer" , "Environmentalist" , "Entertainer" , "Explorer" , "Avatar" , "Extraordinaire" , "Genius" , "Misanthrope" , "Comedian"); | |
my Str @descs = ("Social Entrepreneur" , "Idea Agent" , "Connector of Awesomeness" , "Avid Gamer" , "Social Media Guru" , "U |
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 | |
# Perl6 example of the visitor pattern in https://en.wikipedia.org/wiki/Visitor_pattern | |
# | |
role CarElementVisitor { | |
... | |
} | |
class CarElement { | |
method accept(CarElementVisitor $visitor) { |
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
use IO::Glob; | |
my @ignore = ".gitignore".IO.lines; | |
my $test = none(|@ignore.map(-> $l { glob($l) } ), /^\./ ) ; | |
for ".".IO.dir(:$test) { | |
.say; | |
} |
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
use JSON::Class; | |
use Red; | |
model Foo is table('foo') does JSON::Class { | |
has Int $.id is serial; | |
has Str $.name is column; | |
} | |
my $*RED-DEBUG = $_ with %*ENV<RED_DEBUG>; |
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
my $ip = "130.45.34.36"; | |
my $netmask = "255.255.240.0"; | |
sub inet-aton(Str $ip --> Int) { | |
my Int $v; | |
my $i = 0; | |
for $ip.split(/\./).reverse -> Int() $octet { | |
$v += ( $octet +< ( 8 * $i++)); | |
} |
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
for DIR in * | |
do | |
if [ -d $DIR ] | |
then | |
if [ -f $DIR/.gitmodules ] | |
then | |
pushd $DIR | |
git status | |
MOD=`cat .gitmodules | awk '/path = / { print $3 }'` | |
git reset HEAD |
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
use አማርኛ; | |
መደብ ሰላምታ { | |
method ሰላምታ() { | |
say "መልካም ገና"; | |
} | |
} |
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
use Foo; | |
outer Blob { | |
inner Bleep { | |
} | |
} |
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.c; | |
my $sock = IO::Socket::INET.new(host => 'towel.blinkenlights.nl', port => 666); | |
for $sock.lines -> $v { | |
next if $v ~~ /^('==='|<:Cc>)/; | |
say $v if $v; |