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 / 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 [レギュラー] [その他] [英語]
@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) = @_;
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);
use strict;
use warnings;
use utf8;
use Test::More;
{
no strict qw/refs/;
*{'world!'} = sub { 'world' };
is *{'world!'}{CODE}->(), 'world', 'symbol table call';
@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';
}
@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 / 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 / gist:3806315
Created September 30, 2012 09:22
#素数戦争 の回答 Perl
use strict;
use warnings;
# XXX 素数定理の int ($N*log($N) + $N*log(log($N)) + 1) で抑えて計算したいけど、
# この近似値だとゆるすぎたので、10000番目の素数を決め打ちで、、。
my $max = 104729;
# 問題文で与えられているものは事前準備
my $res = 28; # 5番目までの素数の和
my @composites = ();
@kfly8
kfly8 / gist:4117766
Created November 20, 2012 12:54
透過つきpng8
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=320,height=device-height,user-scalable=0">
<script type="text/javascript">
window.onload = function(){
draw();
}
function draw() {
@kfly8
kfly8 / gist:6327648
Last active December 21, 2015 15:39
dataURIだと、リクエストを二回しているように見えるのだけど、これは何でだろうか・・? http://gyazo.com/14be7c5edfeec270a8303be41fa251fe
<!doctype html>
<head>
<meta charset="utf-8">
</head>
<body>
<img id="hoge" />
<script>
var img = new Image();