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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func entrypoint() { | |
| fmt.Println("1") | |
| setTimeout(func() { |
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 JSON::XS qw(encode_json); | |
| use Benchmark qw(cmpthese); | |
| my $obj = [ map { | |
| +{ | |
| name => 'foo', | |
| age => 123, |
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; | |
| package Node { | |
| use Class::Accessor::Lite ro => [qw/value children/], new => 1; | |
| } | |
| # DSL | |
| package main { | |
| sub node ($;&) { goto \&_node } |
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
| // override filesystem | |
| global.fs = (() => { | |
| class Locks { | |
| constructor() { | |
| this.rw = null; | |
| this.ro = []; | |
| } | |
| getLock() { | |
| if (this.rw !== null) { |
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 5.014000; | |
| use Package::Stash; | |
| use Scalar::Util qw/blessed refaddr/; | |
| use Module::Functions; | |
| package Role::Foo { | |
| sub foo { | |
| my $self = shift; | |
| return "role foo by $self->{name}"; |
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 Plack::ServerTiming; | |
| use Scope::Timer; # it's not exist in the world yet :p | |
| my $duration_time = timer { | |
| ... | |
| }; | |
| Plack::ServerTiming->new($env)->record_timing('foo' => {dur => $duration_time}); |
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
| package main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| ) | |
| func main() { | |
| values := map[string]string{} | |
| for i := 0; i < 50; i++ { |
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 overload '.' => sub { print $_[0]->[0].'.'.$_[1].$/ }; | |
| sub Gotanda () { bless ["Gotanda"] } | |
| sub pm () { 'pm' } | |
| Gotanda.pm |
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 Benchmark qw/cmpthese timethese/; | |
| my @class = qw/Foo Foo::Bar Foo::Bar::Baz/; | |
| sub substr_c { | |
| my $class = shift; | |
| substr $class, 1 + rindex $class, ':'; |