Skip to content

Instantly share code, notes, and snippets.

View tomill's full-sized avatar

Tomita Naoki tomill

View GitHub Profile
require("json");
require("socket.http")
require("socket.url")
function babelfish(lang, query)
lang = lang or "en"
query = query or ""
if lang == "en" or query == "" then
return query
# showtooltip
/cleartarget [dead]
/targetlastenemy [noexists]
/targetenemy [noexists]
/cleartarget [dead]
/stopmacro [noexists]
/cast Hunter's Mark
use strict;
use warnings;
use Config::Pit;
use HTTP::Cookies;
use URI;
use WWW::Mechanize;
use XML::LibXML;
use App::Options(
option => {
use 5.010;
use List::Util qw/first/;
given ('foo') {
warn first { $_ eq 'foo' } qw/ bar baz /; # => bar
}
use strict;
use warnings;
use Benchmark;
my %a = (
foo => 1,
bar => 2,
baz => 3,
);
sub foo {
my ($self, $args) = rule {
uri => { isa => 'Str', xor => [qw(schema host path_query)] },
schema => { isa => 'Str', default => 'http' },
host => { isa => 'Str', default => '127.0.0.1' },
path_query => { isa => 'Str', default => '/' },
method => { isa => 'Str', default => 'GET' },
} @_;
$ perl bench-vs-mobile.pl docomo
docomo 1000
(warning: too few iterations for a reliable count)
(warning: too few iterations for a reliable count)
Rate mobile emoji
mobile 4167/s -- -17%
emoji 5000/s 20% --
$ perl bench-vs-mobile.pl kddi
kddi 1000
@tomill
tomill / gist:752462
Created December 23, 2010 02:19
decode('MIME-Header-ISO_2022_JP', ...)
Index: t/mime_header_iso2022jp.t
===================================================================
--- t/mime_header_iso2022jp.t (リビジョン 38732)
+++ t/mime_header_iso2022jp.t (作業コピー)
@@ -43,6 +43,9 @@
is(encode('euc-jp', $utf8), $decoded);
is($header, $encoded);
+
+ $utf8 = Encode::decode('MIME-Header-ISO_2022_JP', $header);
diff --git a/lib/Encode/MIME/Header.pm b/lib/Encode/MIME/Header.pm
index 5f209b2..d61b589 100644
--- a/lib/Encode/MIME/Header.pm
+++ b/lib/Encode/MIME/Header.pm
@@ -61,10 +61,10 @@ sub decode($$;$) {
}{
if (uc($2) eq 'B'){
$obj->{decode_b} or croak qq(MIME "B" unsupported);
- decode_b($1, $3, $chk);
+ $obj->decode_b($1, $3, $chk);
@tomill
tomill / Ikamusume.pm
Created December 24, 2010 06:37
PerlIO::via::Ikamusume
package PerlIO::via::Ikamusume;
use strict;
use warnings;
use Encode;
use Acme::Ikamusume;
sub import {
binmode STDOUT => ':via(Ikamusume)';
}