Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Imager;
use Imager::QRCode qw(plot_qrcode);
use Encode;
my $img = plot_qrcode('http://mbkr.jp/_kw_l?i=155923');
$img->write(file => "qrcode.gif");
TTでURLに埋め込む文字列をエンコードするときは「url」じゃなくて「uri」を使う
test
152 # product_idに対応する商品情報を取得
153 my $sth_item = $dbh_slave->prepare(<<"SQL");
154 select
155 d.picture_name,
156 i.item_color,
157 i.item_size
158 from
159 m_product p,
160 m_item i,
161 item_image_data d
my $schema = MyAPP::Schema->connect(
'dbi:mysql:myapp_devel;host=localhost;',
'root',
'',
{
AutoCommit => 1,
RaiseError => 1,
PrintError => 1,
RootClass => 'DBIx::Encoding',
encoding => 'cp932',
sub bind_param {
my ($self, @args) = @_;
my $encoding = $self->{private_dbix_encoding}->{encoding};
$args[1] = Encode::encode($encoding, $args[1]);
return $self->SUPER::bind_param(@args);
}
@myfinder
myfinder / gist:1176590
Created August 28, 2011 12:04
OSXのApacheでmod_proxyしたいとき
$ cat /etc/apache2/other/proxy_isucon.conf
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
427c427,429
< for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
---
> /* To work around MacOS llvm-gcc bug: http://llvm.org/bugs/show_bug.cgi?id=9891 */
> const void* civ_start = const_iv;
> for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > civ_start; )
@myfinder
myfinder / gist:2166469
Created March 23, 2012 03:27
.tmux.conf
$ cat .tmux.conf
## UTF-8を用いるかどうかはロケールから自動検出される(必要のある場合のみ指定)
#set-window-option -g utf8 on
#set-option -g status-utf8 on
## 既定のPrefixキー(Ctrl+b)の割り当てを解除
unbind-key C-b
## Ctrl+jをPrefixキーにする
set-option -g prefix C-j
bind-key C-j send-prefix