Skip to content

Instantly share code, notes, and snippets.

@hayajo
hayajo / gist:1393143
Created November 25, 2011 09:38
Qudo::Manager
--- Manager.pm 2011-11-25 18:25:25.000000000 +0900
+++ Manager.pm.new 2011-11-25 17:29:12.000000000 +0900
@@ -5,6 +5,7 @@
use Carp ();
use UNIVERSAL::require;
use Scalar::Util qw/weaken/;
+use Class::Load qw/load_class/;
sub new {
my $class = shift;
@hayajo
hayajo / app.psgi
Created December 6, 2011 07:36
Plack::Middleware::Session::Ex
use Plack::Builder;
use Plack::Session::State::Cookie;
my $state = Plack::Session::State::Cookie->new(session_key => 'hoge_session');
builder {
enable 'Session', store => 'File', state => $state;
sub {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello HogeHoge!!' ] ];
};
@hayajo
hayajo / gist:1564340
Created January 5, 2012 09:01
diff dann/perl-jenkins-template
--- config.xml.org 2012-01-05 17:44:46.000000000 +0900
+++ config.xml 2012-01-05 17:57:12.000000000 +0900
@@ -51,12 +51,33 @@
#===============================================
# Configuration
#===============================================
-export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:${PATH}"
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:${PATH}"
export LOG_DIR=$WORKSPACE/logs
export PERL5LIB="$WORKSPACE/lib:$WORKSPACE/t/lib:$WORKSPACE/t/*/lib:${PERL5LIB}"
@hayajo
hayajo / Encode_JP_Mobile_MIME.diff
Created January 25, 2012 06:42
Encode::JP::Mobile 0.27 patch
--- Encode/JP/Mobile/MIME.pm.org 2012-01-25 15:41:25.000000000 +0900
+++ Encode/JP/Mobile/MIME.pm 2012-01-25 15:41:23.000000000 +0900
@@ -21,6 +21,8 @@
my $encoding = $self->subject_encoding
or die "encoding is not found.";
+ $check = 0 unless (defined $check);
+
$str = $encoding->encode($str, $check);
$str = MIME::Words::encode_mimeword($str, 'B', $encoding->mime_name);
@hayajo
hayajo / gist:1823095
Created February 14, 2012 03:17
Qudo sample
package MyWorker;
use strict;
use warnings;
use Log::Minimal;
use Try::Tiny;
use parent 'Qudo::Worker';
sub work {
@hayajo
hayajo / gist:1826763
Created February 14, 2012 13:29
mh3g_myset.psgi
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Amon2::Lite;
use Data::UUID;
use File::Copy;
use Plack::Builder;
use Plack::Runner;
@hayajo
hayajo / gist:1851081
Created February 17, 2012 06:00
スクリプト別に入力履歴を作成
#!/bin/bash
HISTFILE="$0.hist"
history -r $HISTFILE
read -ep ">> " hoge
history -s $hoge
echo "echo $hoge"
@hayajo
hayajo / gist:1905208
Created February 25, 2012 01:51
Amon2::Auth::Site::Dropbox
use strict;
use warnings;
use utf8;
package Amon2::Auth::Site::Dropbox;
use Mouse;
use WebService::Dropbox;
sub moniker {'dropbox'}
@hayajo
hayajo / gist:1939530
Created February 29, 2012 09:52
Plack::Middleware::Stub
package Plack::Middleware::Stub;
use strict;
use warnings;
BEGIN {
$Plack::Middleware::Stub::VERSION = '0.01';
}
use parent qw/Plack::Middleware/;
@hayajo
hayajo / CD.pm
Created March 14, 2012 05:44
DBIx::SkinnyでRowを拡張
package My::DB::Row::CD;
use strict;
use warnings;
use parent qw/DBIx::Skinny::Row/;
use My::DB::Mixin::Row;
BEGIN {