Skip to content

Instantly share code, notes, and snippets.

View ken39arg's full-sized avatar

Kensaku Araga ken39arg

  • IVRy Inc.
  • Yokohama
View GitHub Profile
package test
import "reflect"
func SliceEqualBy(slice interface{}, checkFun func(i int) bool) bool {
rv := reflect.ValueOf(slice)
for i := 0; i < rv.Len(); i++ {
if !checkFun(i) {
return false
}
use strict;
use warnings;
use utf8;
use 5.012;
use Path::Class;
dir('lib')->recurse( callback => sub {
my $file = shift;
return if $file->is_dir;
@ken39arg
ken39arg / trim_bench.pl
Created November 11, 2014 06:36
前後空白トリム
use common::sense;
use Benchmark qw(:all);
my @words = (
' ほげ ',
'ほげ ',
' ぶう',
'ぶう',
'あいうえおかきくけっこ ',
' あいうえおかきくけっこ',

.author あるいは .maintainer の提案

目的

そこそこの規模のプロジェクトにおいてコードやプロダクトの責任者(全てを知っている人)を明確化する

現状の課題

@ken39arg
ken39arg / benchmark_rate.pl
Created September 16, 2014 04:23
重複無しの重み付きランダム抽選をする際のベンチ
use common::sense;
use Benchmark qw(:all);
use Sub::Rate::NoMaxRate;
use List::MoreUtils qw(none any);
my @putturn1;
push @putturn1, [ 100000, "a100000-1" ];
push @putturn1, map { [ 5, "a5-$_" ] } (1..50);
push @putturn1, map { [ 3, "a3-$_" ] } (1..100);
push @putturn1, map { [ 1, "a1-$_" ] } (1..1000);
### これはOK
local $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD = 1;
my $uri = URI->new( 'https://exapmpe.com/post');
my $request = POST $uri,
Content_Type => 'multipart/form-data',
Content => [
file1 => [ 'file1.mp4' ],
file2 => [ 'file2.jpg' ],
// ==UserScript==
// @name ZAC Emphasize
// @version 0.1
// @copyright nagata-hiroaki@kayac.com
// @namespace http://handlena.me
// @description This script bring little better ZAC to you.
// @include https://asp19.jp.oro.com/kayac/Shinsei/Nippou.asp*
// ==/UserScript==
document.getElementsByXPath = function(expression, parentElement) {
@ken39arg
ken39arg / m3u8probe.pl
Created June 3, 2014 06:44
m3u8の持つ要素を色々調べたいときの殴り書き
use common::sense;
use Furl;
use JSON::XS;
my $FFPROBE = `which ffprobe`;
chomp $FFPROBE;
say encode_json( parse_all( shift ) );
@ken39arg
ken39arg / test-postgresql.pl
Created April 24, 2014 05:51
Test::PostgreSQLを確実に起動する
use common::sense;
use Test::PostgreSQL;
use Path::Class;
# おそらくOSとかによってTest::PostgreSQLの期待するpostgersql.confの設定と違うため
# 環境によって起動がクソ遅くなる
# configを弄った方がいいのでauto_startはoff
my $psql = Test::PostgreSQL->new( auto_start => 0 );

=とか => とか : とかを揃えるとコードが見やすいけど みんなが意識高く揃えるとmergeする時に激しくコンフリクトして辛い問題

スーパーなプログラマ集団はどうしているんだろうなあ

foo : {
 bar : 123,