Skip to content

Instantly share code, notes, and snippets.

View tomill's full-sized avatar

Tomita Naoki tomill

View GitHub Profile
@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);
$ 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
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' },
} @_;
use strict;
use warnings;
use Benchmark;
my %a = (
foo => 1,
bar => 2,
baz => 3,
);
use 5.010;
use List::Util qw/first/;
given ('foo') {
warn first { $_ eq 'foo' } qw/ bar baz /; # => bar
}
use strict;
use warnings;
use Config::Pit;
use HTTP::Cookies;
use URI;
use WWW::Mechanize;
use XML::LibXML;
use App::Options(
option => {
# showtooltip
/cleartarget [dead]
/targetlastenemy [noexists]
/targetenemy [noexists]
/cleartarget [dead]
/stopmacro [noexists]
/cast Hunter's Mark
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