Skip to content

Instantly share code, notes, and snippets.

View hisaichi5518's full-sized avatar
πŸ’™
Flutter!

hisaichi5518 hisaichi5518

πŸ’™
Flutter!
View GitHub Profile
@hisaichi5518
hisaichi5518 / bot.rb
Created August 12, 2013 07:06
tumblr irc bot.
# -*- encoding: utf-8 -*-
require 'cinch'
require 'tumblr_client'
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.server"
c.port = 5000
c.password = 'secret'
c.channels = ["#tumbirc"]
@hisaichi5518
hisaichi5518 / t.pl
Last active December 30, 2015 05:19
time module bench
use Time::Moment;
use DateTime;
use DateTime::Tiny;
use Time::Piece ();
use Time::Piece::Plus ();
use Benchmark qw(:all);
use DateTime::TimeZone;
my $time_zone = DateTime::TimeZone->new(name => "Asia/Tokyo");
@hisaichi5518
hisaichi5518 / test.pl
Created January 28, 2014 12:15
ウェむ
use strict;
use warnings;
sub hoge {
my $test = {};
return {
hoge => fuga() # ここに,がγͺい
%{$test},
}
}
@hisaichi5518
hisaichi5518 / looprove
Created February 14, 2014 08:41
looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooop
#!/usr/bin/env perl
use 5.10.1;
use strict;
use warnings;
use Getopt::Long;
GetOptions(
"count=i" => \my $count,
);
@hisaichi5518
hisaichi5518 / fill.pl
Created February 25, 2014 10:25
εΏ…γš10個返す
use strict;
use warnings;
use List::Util;
use Test::More;
sub fill {
my ($list) = @_;
my $max = 10;
[@$list, map { undef } 1..($max - scalar(@$list))]
@hisaichi5518
hisaichi5518 / JSON.pm
Created March 18, 2014 09:31
HTTP::Body::JSON
package HTTP::Body::JSON;
use strict;
use warnings;
use parent qw(HTTP::Body);
use JSON::XS;
use HTTP::Body;
use Encode qw(encode_utf8);
# based on tokuhirom-san's code
diff --git a/lib/Plack/Request/WithEncoding.pm b/lib/Plack/Request/WithEncoding.pm
index 45d3d3f..aa8f36b 100644
--- a/lib/Plack/Request/WithEncoding.pm
+++ b/lib/Plack/Request/WithEncoding.pm
@@ -81,11 +81,34 @@ sub _decode_parameters {
my @flatten = $stuff->flatten;
my @decoded;
while ( my ($k, $v) = splice @flatten, 0, 2 ) {
- push @decoded, $encoding->decode($k), $encoding->decode($v);
+ push @decoded, $self->__decode($encoding, $k), $self->__decode($encoding, $v);
@hisaichi5518
hisaichi5518 / output.txt
Created April 19, 2014 15:19
includeγ—γŸγ γ‘γ§γ€γ‚―γƒ©γ‚Ήγƒ‘γ‚½γƒƒγƒ‰γ‚‚η”Ÿγ‚„γ—γŸγ„
$ ruby t.rb
{:push=>[#<Proc:[email protected]:27>]}
{:push=>[#<Proc:[email protected]:27>, #<Proc:[email protected]:29>]}
{:push=>[#<Proc:[email protected]:32>]}
{:push=>[#<Proc:[email protected]:32>, #<Proc:[email protected]:34>]}
{:push=>[#<Proc:[email protected]:37>]}
{:push=>[#<Proc:[email protected]:37>, #<Proc:[email protected]:39>]}
package Result::User {
use strict;
use warnings;
use utf8;
sub new { bless {}, shift }
sub to_model {
my $self = shift;
Model::User->new(user => $self);
use 5.10.1;
use strict;
use warnings;
use Text::CSV;
use Text::CSV_XS;
use Encode;
my $csv = Text::CSV->new ({ binary => 1 });
my $xs = Text::CSV_XS->new({ binary => 1 });