Skip to content

Instantly share code, notes, and snippets.

View ab5tract's full-sized avatar

ab5tract ab5tract

  • Amsterdam, Netherlands
View GitHub Profile
use v6;
use XML::Query;
use HTML::Parser::XML;
use HTTP::UserAgent;
my $ua = HTTP::UserAgent.new;
say "Getting the page";
my $response = $ua.get("http://perl6advent.wordpress.com/category/table-of-contents/");
@ab5tract
ab5tract / gist:211fd789b8071fce9599
Created November 30, 2014 14:04
failing noms :(
### *nom*
t/spec/S03-metaops/not.t ...................................... Failed 3/33 subtests
t/spec/S04-declarations/my.rakudo.moar ........................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 20/75 subtests
t/spec/S04-statements/next.t .................................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 12/12 subtests
t/spec/S05-mass/rx.rakudo.moar ................................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 722/739 subtests
(less 8 skipped subtests: 9 okay)
@ab5tract
ab5tract / advent_present.p6
Last active August 29, 2015 14:11
Perl 6 "Coercers and Composers" Followup
class ForYou {
has $.contents;
has $.recipient;
method give {
example_say "Hey " ~ $!recipient ~ "! A " ~ $!contents;
}
};
class Present {
our %TERM;
for 0..^%*ENV<COLUMNS> X 0..%*ENV<ROWS> -> $x, $y {
say "$x $y";
%TERM<cup>[$x][$y] = qq:x{ tput cup $y $x };
}
### i'm getting used to breaking moar :(
➜ lib perl6 Boxbrain.pm
clear
smcup
rmcup
sc
rc
moar(62161,0x7fff79f96300) malloc: *** error for object 0x7f8753d1b530: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
/Users/jhaltiwanger/.rakudobrew/bin/perl6: line 2: 62161 Abort trap: 6 /Users/jhaltiwanger/.rakudobrew/moar-HEAD/install/bin/perl6 "$@"
@ab5tract
ab5tract / error
Last active August 29, 2015 14:13
perl 5 + OO::Monitors
$ perl6 thread-p5.pl6
===SORRY!===
Cannot look up attributes in a type object
@ab5tract
ab5tract / high-level-locking.p6
Last active August 29, 2015 14:14
High Level Locked Counter
use OO::Monitors;
monitor Increment {
has $.counter;
method increment( $thread ) {
$!counter++;
say "incremented in $thread";
}
@ab5tract
ab5tract / 13 vs 8
Last active August 29, 2015 14:14
mishandling-regexes-or-escapes
processed escape sequence as 13 elems
\x[1b][24;36H
manual escape sequence is 8 elems
/home/user/waves> ./bin/waves ~/ruby/xs
Ruby/Extensions: Binding#eval is already defined; not overwriting
Ruby/Extensions: Enumerable#none? is already defined; not overwriting
Ruby/Extensions: Enumerable#one? is already defined; not overwriting
Ruby/Extensions: Integer#even? is already defined; not overwriting
Ruby/Extensions: Integer#odd? is already defined; not overwriting
Ruby/Extensions: Symbol#to_proc is already defined; not overwriting
** Creating new Waves application ...
/usr/lib/ruby/1.8/fileutils.rb:1262:in `initialize': No such file or directory - /home/user/ruby/xs/Rakefile (Errno::ENOENT)
from /usr/lib/ruby/1.8/fileutils.rb:1262:in `open'
@ab5tract
ab5tract / quant-sym-dif.t
Last active August 29, 2015 14:15
failing test for quanthash sym dif
use Test;
plan 5;
my $s = Set.new( <w x y z> );
my $sh = SetHash.new( <x y z> );
my $b = ( w => 1, x => 2, y => 3, z => 4 ).Bag;
my $bh = ( x => 1, y => 2, z => 33 ).BagHash;
is ($s (^+) $b ), (x => 1, y => 2, z => 3).Bag, "(^+) - {$s.gist} (^+) {$b.gist} == {(x => 1, y => 2, z => 3).Bag}";