Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl6
use Grammar::ErrorReporting;
use Grammar::Tracer;
grammar Ingredient::Grammar does Grammar::ErrorReporting {
token TOP { <ingredient> }
token ingredient {
<number>?
#!/bin/bash
perl6 -e 'for 2..2000000 { put $_*$_*$_+1; }' | factor | \
perl6 -e '
my $s = 1;
for lines().kv -> $i, $l {
my $ln = $i + 1;
$s += $l.words[*-1]-1;
say $ln, "\t", $s if $ln %% 1_000;
}
say $s;'
@perlpilot
perlpilot / foo
Created April 6, 2017 19:54
tests for alphah
#!/usr/bin/env perl6
use Test;
##use Grammar::Debugger;
### Package : package-name-ver-arch-build-tag.ext
grammar Pkg {
token TOP { <ws> <name> ['-' <ver>]? ['-' <arch>]? ['-' <build>]? ['-' <tag>]? ['.' <ext>]? }
➤ wget http://www.cpan.org/authors/id/D/DO/DOUGW/Spreadsheet-ParseExcel-0.65.tar.gz
--2017-03-14 13:21:05-- http://www.cpan.org/authors/id/D/DO/DOUGW/Spreadsheet-ParseExcel-0.65.tar.gz
Resolving www.cpan.org (www.cpan.org)... 151.101.192.249, 151.101.64.249, 151.101.128.249, ...
Connecting to www.cpan.org (www.cpan.org)|151.101.192.249|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-03-14 13:21:05 ERROR 500: Internal Server Error.
@perlpilot
perlpilot / Dancer2 app
Last active March 7, 2017 19:46
Weird interaction between LWP::UserAgent and Dancer2
$ cat lib/MyApp.pm
package MyApp;
use Dancer2;
use LWP::UserAgent;
use Data::Dumper::Concise;
our $VERSION = '0.1';
get '/code' => sub {
return "BLAH " . time . "\n";
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index ace9b9b..b0ecaaa 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -7832,6 +7832,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::IVal.new( :value($samemark) ),
);
+ my $Sname := QAST::Node.unique("__Sname");
+
#!/usr/bin/env perl6
say join " ", .lines given q:to/📝/, qq:to/📝/
Hey,
📝
dawg {
[~] q:to/📝/, qq:to/📝/
I heard you
📝
liked heredocs {
my $user_rs = resultset('User')->search_rs([
{ login_id => $login_id },
{ \[ 'LOWER(email) = ?' => lc($login_id) ] }
]);
package MyApp::Schema::Result::BaseTable;
use base qw/DBIx::Class::Core/;
# ... column definitions here ...
v6;
grammar BUU {
token TOP { <abc>+ };
token abc { 'a' <bc>* };
token bc { [ 'b' <c>* ]+ }
token c { 'c' };
};
# default result