Skip to content

Instantly share code, notes, and snippets.

View ken39arg's full-sized avatar

Kensaku Araga ken39arg

  • KAYAC Inc.
  • Yokohama, Kamakura
View GitHub Profile
@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 );
@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 ) );
// ==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) {
### これは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' ],
@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);

.author あるいは .maintainer の提案

目的

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

現状の課題

@ken39arg
ken39arg / trim_bench.pl
Created November 11, 2014 06:36
前後空白トリム
use common::sense;
use Benchmark qw(:all);
my @words = (
' ほげ ',
'ほげ ',
' ぶう',
'ぶう',
'あいうえおかきくけっこ ',
' あいうえおかきくけっこ',
<?php
function upper_and_length($item)
{
global $maxlength;
$item = strtoupper(preg_replace('/([a-z0-9])([A-Z])/', '$1_$2', $item));
if ($maxlength < strlen($item))
$maxlength = strlen($item);
return $item;
}
@ken39arg
ken39arg / gist:933833
Created April 21, 2011 06:14
JSでログの制御ってこれで良いのかな?
var IS_DEV = true;
// logger
var console = window.console;
if (IS_DEV === false || !console) {
console = {
log: function(){},
debug: function(){},
info: function(){},
warn: function(){},
#! /usr/bin/env sh
dir=$1
echo "target > $dir"
pattern="^No*"
files=`find $dir -name '*.php'`
for file in $files
do