Skip to content

Instantly share code, notes, and snippets.

View chsanch's full-sized avatar
🎯
Focusing

Christian Sánchez chsanch

🎯
Focusing
View GitHub Profile
@chsanch
chsanch / test-cro.p6
Created June 5, 2018 15:23
Cro::HTTP::Client example
sub get-term-id ( Cro::HTTP::Client $client, Str $value ) {
my $result;
try {
my $resp = await $client.get: 'terms?short_form=eq.' ~ $value;
# headers => [
# Cro::HTTP::Header.new(
# name => 'Accept',
# value => 'application/vnd.pgrst.object+json'
Could not parse media type 'application/vnd.pgrst.object+json; charset=utf-8'
in method parse at /Users/chsanch/rakudo/install/share/perl6/site/sources/05BFF2181DDDDBD82BDE1DB37531040398856FED (Cro::MediaType) line 74
in method content-type at /Users/chsanch/rakudo/install/share/perl6/site/sources/2D57BFD0FAE9BE7A34BAAF0F334132DC908C20F4 (Cro::HTTP::Message) line 74
in method is-applicable at /Users/chsanch/rakudo/install/share/perl6/site/sources/1CC93450C8A5635DCDD37D27A26254D1394EFED4 (Cro::HTTP::BodyParsers) line 208
in method select at /Users/chsanch/rakudo/install/share/perl6/site/sources/A9E697BB1B16682D433EB51881BF890DA7D7C0B4 (Cro::HTTP::BodyParserSelectors) line 31
in method body at /Users/chsanch/rakudo/install/share/perl6/site/sources/02171369D082867188A3F79893747D2414F424DE (Cro::MessageWithBody) line 77
in sub get-term-id at export-data-dsm.p6 line 99
in block <unit> at export-data-dsm.p6 line 30
@chsanch
chsanch / script.p6
Last active October 23, 2017 22:30
Read a file, and obtain all the words that match a letter combinations list
use v6;
my %words{Str};
%words.push: ( $_.comb.sort.join => $_ ) for "lemario-general-del-espanol.txt".IO.lines;
my @letters = 'o','p','d','e','t','o','r';
# get words for the combinations of different lengths of combinations
my %possible_answers{Int};
%possible_answers.push: ( $_.chars => %words{$_} ) for @letters.combinations(3..7).map(*.sort.join).grep({ %words{$_} });
@chsanch
chsanch / gist:5c7ff94d3cc6052b021b12992bfd828a
Created March 26, 2017 18:52
Build error moar 2017.03 on armv7l
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m --target=mbc --output=blib/Perl6/World.moarvm --encoding=utf8 \
src/Perl6/World.nqp
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m tools/build/gen-cat.nqp moar src/Perl6/Actions.nqp > gen/moar/Perl6-Actions.nqp
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m --target=mbc --output=blib/Perl6/Actions.moarvm --encoding=utf8 \
gen/moar/Perl6-Actions.nqp
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m --target=mbc --output=blib/Perl6/Grammar.moarvm --encoding=utf8 \
src/Perl6/Grammar.nqp
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m tools/build/gen-cat.nqp moar src/Perl6/Optimizer.nqp > gen/moar/Perl6-Optimizer.nqp
/home/chip/.rakudobrew/moar-2017.03/install/bin/nqp-m --target=mbc --output=blib/Perl6/Optimizer.moarvm --encoding=utf8 \
gen/moar/Perl6-Optimizer.nqp

Keybase proof

I hereby claim:

  • I am chsanch on github.
  • I am chsanch (https://keybase.io/chsanch) on keybase.
  • I have a public key whose fingerprint is 4212 FFDE D957 3622 CEE6 4FC4 C270 377A 0353 E5F3

To claim this, I am signing this object: