Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Juan Julián Merelo Guervós JJ

🏠
Working from home
Block or report user

Report or block JJ

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JJ
JJ / all.kids
Last active Mar 18, 2019 — forked from daotoad/all.kids
Getting to Know Perl6 From the Command Line: An Article for the 2018 Perl6 Advent Calendar
View all.kids
1234,Bobby Smith
1235,Rosa Felix
1236,Ramesh Patil
1245,Virginia Ryder
1356,Snively Witherspoon
1358,Burnedette Down
1366,Evelyn Tent
@JJ
JJ / santa.md
Created Dec 1, 2018
Advent Calendar Article (for formatting)
View santa.md

Like 6 Perls in a Pod: document everything

Christmas season was approaching, and Santa was in a gloomy mood. His inbox was full with letters from boys and girls coming from all over.

But.

Were they letter to Santa? Was the kid properly identified by signature, so that you sent the gifts to the proper person and not someone else who might

@JJ
JJ / compilingmath-statx.md
Created Nov 1, 2018
Compilation test for Mathx::Stat
View compilingmath-statx.md

Created this test file

use v6;
use Test;
use-ok 'Mathx::Stat::Probability';

Run with

perl6 -Ilib t/use.t
@JJ
JJ / get-tags-pod-perl6.sh
Created Apr 12, 2018
Extract the tags from the perl6/doc POD6
View get-tags-pod-perl6.sh
# git clone perl6/doc, cd doc
git grep "=begin pod" | perl6 -e 'say slurp().split("\n").grep( /tag/ ).map( * ~~ / \<(.+)\> / ).map( *.values.[0] ).join("\n")'
# (「convert」 「convert」 「convert」 「convert」 「convert」 「self」 「tutorial」 「self」 「tutorial」 「perl6」 「self」 「perl6」 「perl6」 「perl6」 「perl6」 「index」 「perl6」 「list」 「tutorial」 「perl6」 「convert」 「perl6」 「perl6」 「perl6」 「perl6」 「perl6」 「tutorial」 「perl6」 「perl6」 「perl6」 「perl6」 「perl6」 「perl6」 「tutorial」 「perl6」 「perl6」 「index」 「perl6」 「convert」 「perl6」 「perl6」 「perl6」 「perl6」 「pod6」 「perl6」 「tutorial」 「index」 「perl6」 「perl6」 「index」 「tutorial」 「perl6」)
@JJ
JJ / failing-c-channels.p6
Last active Mar 22, 2018
(Failing) concurrent channels in perl6
View failing-c-channels.p6
my Channel $c .= new;
my Channel $c2 = $c.Supply.batch( elems => 2).Channel;
my $count = 0;
$c.send($_) for ^40;
my $work = start react whenever $c -> $item {
$c.send( $item );
say "This is $item";
}
@JJ
JJ / is-product.p6
Created Dec 2, 2017
Check whether an item in a list is a product
View is-product.p6
use v6;
use JSON::Tiny;
use Wikidata::API;
sub MAIN( Str $toy-list = 'list.json' ) {
my $toys = from-json $toy-list.IO.slurp();
say $toys.grep( { is-product( $^þ) } );
}
@JJ
JJ / list.p6
Created Dec 2, 2017
Find items in a markdown list
View list.p6
use v6;
use Text::Markdown;
use JSON::Tiny;
sub MAIN( Str $letter-to-santa = 'letters/dear-santa-list.md' ) {
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp());
my $flip = False;
my $list = $letter.items
.grep( { $flip = ( $flip
@JJ
JJ / sections.p6
Created Dec 2, 2017
Finds the "good" in a series of sections
View sections.p6
use Text::Markdown;
sub MAIN( Str $letter-to-santa = 'letters/dear-santa-sections.md' ) {
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp());
my $flip = False;
my @paragraphs = $letter.items.grep( { $flip = ($^þ ~~ Text::Markdown::Heading and $^þ.level == 2)?? !$flip !! $flip } );
say so any @paragraphs.map( {$^þ.Str ~~ /good/ } );
}
@JJ
JJ / address.p6
Created Dec 2, 2017
Extract heading from a markdown-marked letter
View address.p6
use v6;
use Text::Markdown;
sub MAIN( Str $letter-to-santa = 'letters/dear-santa.md' ) {
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp());
say so $letter.items.grep( { $^þ ~~ Text::Markdown::Heading } );
}
@JJ
JJ / letter.elm
Created Dec 2, 2017
Letter to santa in Markdown
View letter.elm
import Html
import Markdown
letter : Html msg
letter =
Markdown.toHtml [class "content"] """
# Letter to Santa
I've been *real* **good** so I want this for Christmas
1. A Death Star.
2. A green unicorn.
You can’t perform that action at this time.