- 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
#cat dt2.pl | |
#!/usr/local/bin/perl | |
use strict;use DateTime; | |
use DateTime::Format::MySQL; | |
my $sql_datetime = '2009-09-07 13:15:00'; | |
my $dt1 = DateTime->new(year => 2009, month => 9, day => 7, hour => 13, minute => 15, second => 0); | |
my $dt2 = DateTime->new(year => 2009, month => 9, day => 7, hour => 13, minute => 15, second => 0, time_zone => 'Asia/Tokyo'); | |
my $dt3 = DateTime::Format::MySQL->parse_datetime($sql_datetime); |
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
// ==UserScript== | |
// @name rssmix LDRize | |
// @namespace http://d.hatena.ne.jp/a666666/ | |
// @include http://pikapika.to/rssmix/* | |
// ==/UserScript== | |
(function(){ | |
var $ = unsafeWindow.jQuery; | |
$('dt.rheader div a.article').each(function(i,elem){ | |
$(elem).addClass("taggedlink"); | |
$(elem).wrap( |
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 LWP::UserAgent; | |
use Test::Simple tests => 1; | |
my $ua = LWP::UserAgent->new(); | |
my $response = $ua->get('http://1password.com/'); | |
ok $response->base, 'http://agilewebsolutions.com/products/1Password'; |
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 LWP::UserAgent; | |
use Data::Dumper; | |
my $ua = LWP::UserAgent->new(); | |
my $url = 'http://livedoor.blogcms.jp/'; | |
print '='x35, ' last response ', '='x35, "\n"; | |
my $response = $ua->get($url); |
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 | |
BEGIN { | |
require Lingua::JA::Summarize::Extract::ResultSet; | |
*Lingua::JA::Summarize::Extract::ResultSet::as_string = sub { | |
my $self = shift; | |
my $text; | |
my @result; | |
for my $line (@{ $self->sentences }) { | |
push @result, $line; |
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
--- ResultSet.pm.orig 2007-06-10 17:50:39.000000000 +0900 | |
+++ ResultSet.pm 2009-10-02 10:19:23.000000000 +0900 | |
@@ -61,7 +61,7 @@ | |
} | |
my $len = $self->length; | |
- $text =~ s/^(.{$len}).*$/$1¥n/s; | |
+ $text =~ s/^(.{$len}.*?¥x{3002}).*$/$1¥n/s; | |
$text; | |
} |
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 Test::More; | |
plan tests => 6; | |
my $re = qr/^(-{5}|-{7})\n$/; | |
my $ret; | |
my $str1 = "-----\n"; # 5 | |
ok( ($str1 =~ /$re/) ); |
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 Test::Base; | |
plan tests => 1 * blocks; | |
run_is input => 'expected'; | |
sub delimiter_escape_filter { | |
my $html = shift; | |
my $SEP = qr/^(-{8})(¥n)$/; |
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 HTML::TreeBuilder; | |
use Test::Base; | |
plan tests => 1 * blocks; | |
run_is input => 'expected'; | |
sub html_tree_parse { | |
my $tree = HTML::TreeBuilder->new(); |
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 Benchmark; | |
use Encode; | |
use Encode::Guess; | |
my $var = q{いいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいab}; # euc-jp octets, 256 bytes | |
my $charset = eval { Encode::Guess::guess_encoding($var, qw(utf-8 euc-jp shiftjis))->name } || 'euc-jp'; # euc-jp | |
my $maxlength = 255; |