- GitHub Staff
- https://bento.me/kyanny
- @kyanny
- in/kyanny
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 perl | |
use strict; | |
use Encode; | |
my $text = q{王将}; | |
my $html = q{餃子の王将(ぎょうざのおうしょう)は、京都府京都市山科区に本社を置く王将フードサービスが京阪地区を中心に全国展開する、大阪風の餃子を売りにした中華料理チェーンの名称。通称は「王将」、「京都王将」である。}; | |
my $decoded_text = decode('euc-jp', $text); | |
my $decoded_html = decode('euc-jp', $html); |
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 perl | |
# | |
# HTML の中から特定のタグだけ削除する (ただしツリー構造ごと削除はしない) | |
# | |
use HTML::TreeBuilder; | |
use Test::Base; | |
plan tests => 1 * blocks; | |
sub remove_tag { | |
my $html = shift; |
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 perl | |
# | |
# HTML::Element#content_list() の返り値 | |
# | |
use HTML::TreeBuilder; | |
use Test::Base; | |
plan tests => 1 * blocks; | |
sub empty_content_scalar { | |
my $html = shift; |
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 perl | |
# | |
# HTML::Element の属性値を操作する | |
# | |
use HTML::TreeBuilder; | |
use Test::Base; | |
plan tests => 1 * blocks; | |
sub remove_attr { | |
my $html = shift; |
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
# yum install perl-* | |
# cpan -i Plack | |
# cpan -i Devel::StackTrace::AsHTML | |
# cpan -i Plack | |
# cpan -i HTTP::Request::AsCGI | |
# cpan -i Plack | |
# wget http://cpansearch.perl.org/src/MIYAGAWA/Plack-0.9008/eg/dot-psgi/Dumper.psgi | |
# plackup -a Dumper.psgi -p 3000 | |
# wget http://cpansearch.perl.org/src/MIYAGAWA/Plack-0.9008/eg/dot-psgi/plack-req.psgi | |
# plackup -a plack-req.psgi -p 3000 |
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 perl | |
use strict; | |
use DateTime; | |
our $cnt = 0; | |
our $int = 0; | |
$SIG{INT} = sub { | |
warn sprintf('sigint received at %s.', DateTime->now(time_zone => 'local')); | |
$int++; |
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
package MyApp::SimpleConfig; | |
use Moose; | |
with qw(MooseX::Getopt MooseX::SimpleConfig); | |
has 'config' => ( | |
is => 'ro', | |
isa => 'HashRef', | |
); |
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
package MyApp::Schema; | |
use strict; | |
use base qw(DBIx::Class::Schema); | |
__PACKAGE__->load_namespaces(); | |
use Data::Dumper; | |
my $source = __PACKAGE__->source('Foo'); | |
for my $table (qw(foo foo_200912)) { | |
my $new_source = $source->new($source); |
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 DateTime; | |
my $the_first_day_of_this_month = DateTime->last_day_of_month( | |
year => $today->year, | |
month => $today->month, | |
)->subtract(months => 1)->add(days => 1); |
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 | |
require 'rubygems' | |
gem 'exifr' | |
require 'exifr' | |
exif = EXIFR::JPEG.new('xxx_orig.jpg') | |
p exif.date_time | |
p exif.date_time_original | |
p exif.date_time_digitized |