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 /; | |
| use Math::BigInt; | |
| my $bigint = Math::BigInt->from_hex('0x0123456789ABCDEF'); | |
| my $modulus = Math::BigInt->bone << 32; | |
| cmpthese timethese 100000, +{ | |
| 'Bit operation' => sub { |
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
| CC := gcc | |
| google-2fa: google-2fa.o base32.o hmac.o sha1.o | |
| $(CC) -g -o $@ $+ | |
| clean: | |
| $(RM) *.o google-2fa | |
| google-2fa.o: google-2fa.c base32.h hmac.h sha1.h | |
| demo.o: demo.c base32.h hmac.h sha1.h |
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 | |
| use 5.010000; | |
| use strict; | |
| use warnings; | |
| use feature qw/ say /; | |
| use Config::Pit qw/ pit_get /; | |
| use Term::ANSIColor qw/ colored /; | |
| use Text::Markdown::GFM::Lite; | |
| sub process |
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
| .clickable { | |
| cursor: pointer; | |
| } |
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
| <?php | |
| require_once 'MyConfig.php'; | |
| $_SERVER['APP_ENV'] = 'development'; | |
| MyConfig::param('dsn'); # => 'sqlite:/tmp/development.db' | |
| $_SERVER['APP_ENV'] = 'production'; | |
| MyConfig::param('dsn'); # => 'sqlite:/tmp/production.db' |
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 My::Cabinet; | |
| use strict; | |
| use warnings; | |
| use Plack::Util ( ); | |
| use Scope::Container::Cabinet -base; | |
| register 'Furl' => sub { | |
| Plack::Util::load_class('Furl'); | |
| return Furl->new(agent => 'Furl'); | |
| }; |
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 strict; | |
| use warnings; | |
| use Getopt::Long ( ); | |
| our $VERSION = '1.3'; | |
| main : { | |
| my $opt = parse_options( ); | |
| $opt->{header} = build_range(delete $opt->{range}, delete $opt->{bias}); | |
| $opt->{agent} = build_user_agent($opt->{agent}); |
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 Method::Delegation; | |
| use strict; | |
| use warnings; | |
| use Exporter 'import'; | |
| our @EXPORT = qw/ delegate /; | |
| sub delegate ($%) | |
| { | |
| my ($key, %args) = @_; | |
| my $pkg = caller(0); |
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
| diff --git a/lib/Teng.pm b/lib/Teng.pm | |
| index 8a38ee0..30a3756 100644 | |
| --- a/lib/Teng.pm | |
| +++ b/lib/Teng.pm | |
| @@ -368,7 +368,7 @@ sub search_by_sql { | |
| sub _guess_table_name { | |
| my ($class, $sql) = @_; | |
| - if ($sql =~ /\sfrom\s+([\w]+)\s*/si) { | |
| + if ($sql =~ /\sfrom\s+"?([\w]+)"?\s*/si) { |
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 t::Utils; | |
| use Mock::Basic; | |
| use Test::More; | |
| my $dbh = t::Utils->setup_dbh; | |
| my $db = Mock::Basic->new({ dbh => $dbh }); | |
| $db->setup_test_db; | |
| $db->insert('mock_basic',{ | |
| id => 1, |