This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Err... see http://gist.github.com/327467 for the most up-to-date version | |
#!/usr/bin/perl | |
use strict; | |
use SDL; | |
use SDL::App; | |
use SDL::Game::Rect; | |
use SDL::Event; | |
use SDL::Events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use SDL; | |
use SDL::App; | |
use SDL::Game::Rect; | |
use SDL::Event; | |
use SDL::Events; | |
use Coro; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Boiled down to it's essentials? This is how to write a twiggy-compatible | |
# Coro-using PSGI app. | |
use strict; | |
use EV; | |
use Coro::AnyEvent; | |
use Coro; | |
my $app = sub { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original API | |
my $grammar = Marpa::Grammar->new( | |
{ start => 'Expression', | |
actions => 'My_Actions', | |
default_action => 'first_arg', | |
rules => [ | |
{ lhs => 'Expression', rhs => [qw/Term/] }, | |
{ lhs => 'Term', rhs => [qw/Factor/] }, | |
{ lhs => 'Factor', rhs => [qw/Number/] }, | |
{ lhs => 'Term', rhs => [qw/Term Add Term/], action => 'do_add' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use Image::Magick; | |
# auxiliary variables | |
my $img_id = 0; #loop index | |
my @ordered_squares; | |
my $rotation = 180; | |
#Width and Height of each box, squares per side |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ prove -v unittest.t | |
unittest.t .. | |
ok 1 - expect_run | |
ok 2 - Load program | |
ok 3 - print $a0 | |
ok 4 - $a0 starts out as 0 | |
ok 5 - Stepping toward [main] | |
ok 6 - Initial jump to [main] | |
ok 7 - Stepping past [main] | |
ok 8 - print $a0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awwaiid@misao:~/tmp/modtest$ cat -n MyModule.pm6 | |
1 module MyModule { | |
2 sub hello { | |
3 say "Hello!"; | |
4 } | |
5 } | |
6 | |
awwaiid@misao:~/tmp/modtest$ cat -n demo.p6 | |
1 #!/usr/bin/env perl6 | |
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------- [List variables] --------------- | |
my vars: $_ $! @parent_vars $*DISPATCHER @my_vars RETURN $¢ $x $/ | |
caller vars: $y $_ $! $*DISPATCHER RETURN $¢ $x $/ | |
------------- [Eval Variable] --------------- | |
Local $x=5 | |
EVAL $x=5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
# Run with: perl6 --setting=RESTRICTED webrepl.p6 | |
use HTTP::Server::Tiny; | |
use URI::Encode; | |
use HTML::Entity; | |
use UUID; | |
sub parse-params($data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use Grammar::Tracer; | |
# use Grammar::Debugger; | |
grammar Offsides { | |
token TOP { | |
<tree>* | |
} |