Skip to content

Instantly share code, notes, and snippets.

View memememomo's full-sized avatar
🏠
Working from home

Uchiko memememomo

🏠
Working from home
  • Aichi, Japan
View GitHub Profile
@memememomo
memememomo / file0.txt
Created May 17, 2014 01:27
Mojoliciousでエラーメッセージ画面を変更する ref: http://qiita.com/uchiko/items/1efe5889816fda06fa9d
$ MOJO_MODE=production morbo script/myapp
@memememomo
memememomo / diff
Created May 16, 2014 13:16
MojoliciousのCookieヘッダのパースエラーの修正パッチ
diff --git a/lib/Mojo/Cookie/Response.pm b/lib/Mojo/Cookie/Response.pm
index 30d9aa1..98b4fa5 100644
--- a/lib/Mojo/Cookie/Response.pm
+++ b/lib/Mojo/Cookie/Response.pm
@@ -31,7 +31,7 @@ sub parse {
# "expires" is a special case, thank you Netscape...
if ($name =~ /^expires$/i) {
push @$pairs, @{shift @$tree // []};
- my $len = $pairs->[0] && $pairs->[0] =~ /-/ ? 6 : 10;
+ my $len = ($pairs->[0] // '') =~ /-/ ? 6 : 10;
@memememomo
memememomo / app.psgi
Created May 15, 2014 15:22
開発用にplackupで自己認証サーバを立ち上げる ref: http://qiita.com/uchiko/items/24670c605cdc1fc2e7e7
use Plack::Builder;
builder {
enable sub {
my $app = shift;
sub {
my $env = shift;
$env->{"HTTP_X_Forwarded_HTTPS"} = 1;
my $res = $app->($env);
return $res;
};
@memememomo
memememomo / basic.t
Created May 13, 2014 10:35
Plack::Middlewareに依存したアプリをTest::Mojoでテストする ref: http://qiita.com/uchiko/items/881376f9a8fce3d702d1
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('MyApp');
$t->app->plugin(plack_middleware => [
'Session' => {store => 'File'},
]);
@memememomo
memememomo / file0.txt
Last active August 29, 2015 14:01
phpenvの導入して複数バージョンのPHPを管理する ref: http://qiita.com/uchiko/items/5f1843d3d848de619fdf
$ curl -L https://raw.github.com/CHH/phpenv/master/bin/phpenv-install.sh | bash
$ git clone git://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build
$ echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(phpenv init -)"' >> ~/.bashrc
$ exec $SHELL -l
@@ -358,6 +358,11 @@
cd "$source_path"
{
+ if which apxs > /dev/null 2>&1; then
+ _LIBEXECDIR=`apxs -q LIBEXECDIR`
+ sed -i -e "s|LIBEXECDIR='\$(INSTALL_ROOT)$_LIBEXECDIR'|LIBEXECDIR=$PREFIX/libexec|" $TMP/source/$DEFINITION/Makefile
+ fi
+
make
MsgBox "Hello world"
Debug.Print "Hello world"
@memememomo
memememomo / .wgetrc
Created May 8, 2014 09:07
Perlbrew で install-patchperl/install-cpanm が失敗する場合 ref: http://qiita.com/uchiko/items/c1f5b0a0c5245dbb8d55
check_certificate = off
$ plenv install-cpanm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 303 0 303 0 0 2648 0 --:--:-- --:--:-- --:--:-- 2657
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 226 100 226 0 0 198 0 0:00:01 0:00:01 --:--:-- 198
Bareword found where operator expected at - line 3, near "400 Bad"
(Missing operator before Bad?)
Bareword found where operator expected at - line 6, near "<p>Your"
(Missing operator before Your?)
@memememomo
memememomo / file0.txt
Created April 15, 2014 07:09
TAP::Formatter::JUnitで、subtestに設定した日本語が16進数コードになる現象についての対応 ref: http://qiita.com/uchiko/items/65254be5e9504c9c1742
perl -i -ple 's/\[\\x([a-f0-9]{2})\]/pack("H*", $1)/egx' result.xml