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
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
#!/usr/bin/env ruby | |
if ARGV == ['who', 'is', 'this?'] | |
puts "THIS IS SPARTA!!!" | |
end | |
puts (words = File.read('/usr/share/dict/words')).length | |
good_words = words.split.select {|w| w.size > 6} | |
puts good_words.sample(3).join(' ') | |
Thread.new{ STDERR.<< ", \n A PLAY IN 3 PARTS.\n\n============ PAGE " } | |
puts good_words.length | |
puts File.read(__FILE__).split.detect{|_| _ =~ /SPARTA/} |
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 IO::Handle; | |
STDOUT->autoflush(); | |
STDERR->autoflush(); | |
print "1\n"; | |
my $is_swapped = `xmodmap -pke | grep 'keycode 10 = exclam'`; |
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
use HOI::Match; | |
psub point_extract => | |
"point (x _) :: r" => sub { my %args = @_; $args{x} + point_extract($args{r}) }, | |
"nil" => sub { 0 }; | |
point_extract( | |
[ | |
{"type" => "point", "val" => [ 1, 2 ]}, | |
{"type" => "point", "val" => [ 2, 4 ]}, |
OlderNewer