Skip to content

Instantly share code, notes, and snippets.

View kan's full-sized avatar

Kan Fushihara kan

View GitHub Profile
ラーメン
つけ麺
油そば
野菜
二郎
スープ
Posted3weeks ago
@kan
kan / gist:1576906
Created January 8, 2012 02:25
Images.Mediaの有効なbucket一覧を取得する
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
Cursor c = managedQuery(uri, null, null, null, null);
buckets.clear();
c.moveToFirst();
for (int i = 0; i < c.getCount(); i++) {
String bucket_id = c
.getString(c.getColumnIndexOrThrow("bucket_id"));
String bucket_name = c.getString(c
.getColumnIndexOrThrow("bucket_display_name"));
buckets.put(bucket_id, bucket_name);
@kan
kan / hoge.pl
Created October 5, 2012 07:06
今日の電波
use WAF::Casual;
sub index {
# render HTML
return "hello world";
}
sub json {
req my $self, $x, $y;
use Acme::PrettyCure::Girl::CurePeace;
my $peace = Acme::PrettyCure::Girl::CurePeace->new;
say $peace->challenge_with_jankenpon;
# % ./peace.pl
# ピカピカぴかりんじゃんけんぽん (チョキ)♪ キュアピース!
use Acme::PrettyCure::Girl::CurePeace;
my $peace = Acme::PrettyCure::Girl::CurePeace->new;
say $peace->challenge_with_jankenpon($ARGV[0]);
# % ./peace2.pl 17
# ピカピカぴかりんじゃんけんぽん (パー)♪ キュアピース!
# ./example.pl -a 100 --border=20 -c
use Smart::Options;
warn Dumper(argv);
=> {
'a' => 100,
'border' => 20,
'c' => 1,
use Smart::Options;
my $argv = Smart::Options->new()->type(foo => 'Str')->parase('bar');
$argv->{foo} # => 'bar'
my $argv = Smart::Options->new()->type(foo => 'ArrayRef')->parase('bar');
$argv->{foo} # => ['bar']
@kan
kan / bench.pl
Created February 23, 2013 07:16 — forked from anonymous/bench.pl
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Benchmark 'cmpthese';
use Data::Riak;
use Data::Riak::Fast;
use Net::Riak;
@kan
kan / gist:5027250
Last active December 14, 2015 04:19 — forked from kazuho/gist:5027236

#MessagePackの文字列型追加において、Extended型を導入する提案

本提案は https://gist.github.com/frsyuki/5022569 https://gist.github.com/frsyuki/5022460 において提案された「バイナリ型」の構造に変更を施すものである。

##解決しようとする問題

  • MessagePackへの拡張は今後行われないとしても、独自に拡張する提案が今後頻発しそう
  • 拡張フォーマットは、既存のMessagePackに対して後方互換にならない(なりようがない)ため、相互運用性を損なう可能性が高い

##提案する手法

In considering the name of Smart::Options, I referred to the following modules.
https://metacpan.org/module/Smart::Comments
https://metacpan.org/module/Smart::Args
These modules are used widely and I think that using Smart:: as namespace of a CPAN module has taken large agreement.
Moreover, since it thinks that it should not be simply performed since change of a module name is an act which gives a user a burden, there is no intention according to naming change.