Skip to content

Instantly share code, notes, and snippets.

View kfly8's full-sized avatar
🐪
Working from home

kobaken kfly8

🐪
Working from home
View GitHub Profile
@kfly8
kfly8 / SYNOPSIS.md
Last active May 14, 2018 10:32
Lodash.pm export design

general case

use Lodash;
# => export `_`

_->add(1,2) # => 3
_(list)->chain->head->value
@kfly8
kfly8 / example.md
Created March 3, 2018 10:04
Variable::Declaration example
use strict;
use warnings;
use feature qw/say/;

use Variable::Declaration;
use Types::Standard '-all';

let $foo = 'hello';
say $foo; # => hello
@kfly8
kfly8 / benchmark-simple.pl
Created December 8, 2017 08:59
Benchmark Perl Type constraints
#!perl -w
use 5.10.0;
use strict;
use Benchmark qw(:all);
use Data::Validator;
use Function::Parameters qw/fun/;
use Kavorka fun => { -as => 'kavorka_fun' };
print "perl: $]\n";
@kfly8
kfly8 / app.psgi
Created March 24, 2015 08:10
session の finalizeがもたもた
use strict;
use warnings;
use utf8;
use Amon2::Lite;
use Cache::Memcached::Fast;
use Plack::Session::Store::Cache;
get '/' => sub {
my $c = shift;
@kfly8
kfly8 / bbs.pl
Created February 28, 2015 07:06
Perl入学式 #6 の掲示板の練習問題で、DBに記事を格納する形にしてみる
#!/usr/bin/env perl
use Mojolicious::Lite;
use DBIx::Sunny;
app->attr(dbh => sub { DBIx::Sunny->connect('dbi:mysql:dbname=bbs', 'root','') });
get '/' => sub {
my $c = shift;
my $entries = app->dbh->select_all('SELECT * FROM entry');
@kfly8
kfly8 / can.pl
Last active August 29, 2015 14:11
Perl Advent Calender 2014 . 17th
use strict;
use warnings;
use utf8;
use feature qw/say/;
my $dog = bless {}, 'Dog';
if (can $dog 'bow') {
say 'can bow';
}
use strict;
use warnings;
use utf8;
use Test::More;
{
no strict qw/refs/;
*{'world!'} = sub { 'world' };
is *{'world!'}{CODE}->(), 'world', 'symbol table call';
use strict;
use warnings;
use utf8;
use Benchmark qw/:hireswallclock/;
my $x = 20141024;
my $b = timeit(10000000, sub { $x ** 2 }); # => isa 'Benchmark'
print timestr($b);
@kfly8
kfly8 / cyclic
Last active August 29, 2015 14:06
'a.b.c' => 1 # -> { a => { b => {c => 1}}}
#!/usr/bin/env perl
use 5.10.0;
use strict;
use warnings;
use utf8;
use Test::More;
sub merge {
my ($a, $b) = @_;
@kfly8
kfly8 / todo.md
Last active August 29, 2015 14:05
YAPCスタッフとして、YAPCの各トーク にスライドを埋める為のTODOリスト  

YAPC::Asia 2014 talks and slide

http://yapcasia.org/2014/talk/list
あとで引っ越し予定なので、スタッフ以外はブクマするべからず

TODO!!

  • One layer down below. (20 分)
  • Kang-min Liu [レギュラー] [その他] [英語]