Skip to content

Instantly share code, notes, and snippets.

View zoffixznet's full-sized avatar
💭
😂

Zoffix Znet zoffixznet

💭
😂
View GitHub Profile
zoffix@ZofMain:~/Desktop/CPANPRC/doc$ gd
diff --git a/lib/Language/5to6.pod b/lib/Language/5to6.pod
index 9498dc1..0d7176a 100644
--- a/lib/Language/5to6.pod
+++ b/lib/Language/5to6.pod
@@ -759,6 +759,17 @@ Instead, use a C<NEXT> block within the body of the loop.
=comment NOTE FOR EDITORS: When adding functions, please place them in
alphabetical order.
+=head3 Built-ins with bare blocks
class Employee {
subset Salary of Real where * > 0;
subset NonEmptyString of Str where * ~~ /\S/; # at least one non-space character
has NonEmptyString $.name is rw;
has NonEmptyString $.surname is rw;
has Salary $.salary is rw;
method gist {
return qq:to[END];
zoffix@ZofMain:/tmp$ time perl -MMojo::DOM -wlE 'say Mojo::DOM->new("<foo><bar>baz</bar></foo>")->at("bar")->all_text'
baz
real 0m0.041s
user 0m0.032s
sys 0m0.008s
zoffix@ZofMain:/tmp$ time perl6 -MInline::Perl5 -e 'use Mojo::DOM:from<Perl5>; say Mojo::DOM.new("<foo><bar>baz</bar></foo>").at("bar").all_text'
baz
real 0m3.935s
fsdfdsfsdfsdfsdfsdfsd
@zoffixznet
zoffixznet / nopaste.txt
Created October 12, 2015 00:24
Foo Bar
foo
@zoffixznet
zoffixznet / rgb2hsl.p6
Created November 16, 2015 21:48
Convert RGB to HSL
use v6;
sub rgb2hsl ( $r is copy, $g is copy, $b is copy ) {
$_ /= 255 for $r, $g, $b;
# Formula cortesy http://www.rapidtables.com/convert/color/rgb-to-hsl.htm
my $c_max = max $r, $g, $b;
my $c_min = min $r, $g, $b;
my \Δ = $c_max - $c_min;
[Sat Nov 21 17:36:55 2015] [info] Starting build /G0BXqCQ5RGhLItaqX5EiQ==
[Sat Nov 21 17:36:55 2015] [info] Using database file modulesperl6.db
[Sat Nov 21 17:36:55 2015] [info] Cleaning up dist logos dir [public/content-pics/dist-logos]
[Sat Nov 21 17:36:55 2015] [info] Loading META.list from https://raw.githubusercontent.com/perl6/ecosystem/master/META.list
[Sat Nov 21 17:36:55 2015] [info] ... a URL detected; trying to fetch
[Sat Nov 21 17:36:55 2015] [info] Found 461 dists
[Sat Nov 21 17:36:55 2015] [info] Processing dist 1 of 461
[Sat Nov 21 17:36:55 2015] [info] Using DbBuilder::Dist::Source::GitHub to load https://raw.githubusercontent.com/tadzik/perl6-Acme-Meow/master/META.info
[Sat Nov 21 17:36:55 2015] [info] Downloading META file from https://raw.githubusercontent.com/tadzik/perl6-Acme-Meow/master/META.info
[Sat Nov 21 17:36:55 2015] [info] Parsing META file
use v6;
my $chan = '#perl6';
await IO::Socket::Async.connect('irc.freenode.net',6667).then( -> $p {
my $sock = $p.result;
$sock.print("NICK P6\nUSER P6 Perl6 work :Perl6 Perl6\nJOIN $chan\n");
my $timer = Promise.in(5).then({ now });
react {
whenever $timer -> $now {
say "Now is $now\n";
$sock.print: ":P6!P6\@work PRIVMSG $chan :Now is $now\n";
use v6;
my $chan = '#zofbot';
await IO::Socket::Async.connect('10.10.11.12',6667).then( -> $p {
my $sock = $p.result;
$sock.print("NICK P6\nUSER P6 Perl6 work :Perl6 Perl6\nJOIN $chan\n");
react {
whenever $sock.chars-supply() -> $v is copy {
$v.say;
if ( $v ~~ /':End of NAMES list'/ ) {
Supply.interval(5).tap({
use v6;
my $chan = '#perl6';
await IO::Socket::Async.connect('irc.freenode.net',6667).then( -> $p {
my $sock = $p.result;
$sock.print("NICK P6\nUSER P6 Perl6 work :Perl6 Perl6\nJOIN $chan\n");
react {
whenever $sock.chars-supply() -> $v is copy {
$v.say;
if ( $v ~~ /':End of NAMES list'/ ) {
Supply.interval(5).tap({