use Lodash;
# => export `_`
_->add(1,2) # => 3
_(list)->chain->head->value
This file contains hidden or 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 strict; | |
| use warnings; | |
| use utf8; | |
| use Data::Validator; | |
| use Types::Standard qw(Int); | |
| use DDP; | |
| sub strict_seq { | |
| my $rule = Data::Validator->new( |
use strict;
use warnings;
use feature qw/say/;
use Variable::Declaration;
use Types::Standard '-all';
let $foo = 'hello';
say $foo; # => hello
This file contains hidden or 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
| #!perl -w | |
| use 5.10.0; | |
| use strict; | |
| use Benchmark qw(:all); | |
| use Data::Validator; | |
| use Function::Parameters qw/fun/; | |
| use Kavorka fun => { -as => 'kavorka_fun' }; | |
| print "perl: $]\n"; |
This file contains hidden or 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 strict; | |
| use warnings; | |
| use utf8; | |
| use Amon2::Lite; | |
| use Cache::Memcached::Fast; | |
| use Plack::Session::Store::Cache; | |
| get '/' => sub { | |
| my $c = shift; |
This file contains hidden or 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 perl | |
| use Mojolicious::Lite; | |
| use DBIx::Sunny; | |
| app->attr(dbh => sub { DBIx::Sunny->connect('dbi:mysql:dbname=bbs', 'root','') }); | |
| get '/' => sub { | |
| my $c = shift; | |
| my $entries = app->dbh->select_all('SELECT * FROM entry'); |
This file contains hidden or 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 strict; | |
| use warnings; | |
| use utf8; | |
| use feature qw/say/; | |
| my $dog = bless {}, 'Dog'; | |
| if (can $dog 'bow') { | |
| say 'can bow'; | |
| } |
This file contains hidden or 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 strict; | |
| use warnings; | |
| use utf8; | |
| use Test::More; | |
| { | |
| no strict qw/refs/; | |
| *{'world!'} = sub { 'world' }; | |
| is *{'world!'}{CODE}->(), 'world', 'symbol table call'; |
This file contains hidden or 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 strict; | |
| use warnings; | |
| use utf8; | |
| use Benchmark qw/:hireswallclock/; | |
| my $x = 20141024; | |
| my $b = timeit(10000000, sub { $x ** 2 }); # => isa 'Benchmark' | |
| print timestr($b); |
This file contains hidden or 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 perl | |
| use 5.10.0; | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use Test::More; | |
| sub merge { | |
| my ($a, $b) = @_; |