Skip to content

Instantly share code, notes, and snippets.

package MouseX::Log::Log4perl;
use Mouse::Role;
use Log::Log4perl;
our $VERSION = '0.01';
has 'logger' => (
is => 'rw',
isa => 'Log::Log4perl',
# release-0.01 (CPAN)
Benchmark: timing 10000 iterations of match, match_block, to_block, with...
match: 14.2198 wallclock secs (13.88 usr + 0.05 sys = 13.93 CPU) @ 717.88/s (n=10000)
match_block: 14.6266 wallclock secs (14.44 usr + 0.04 sys = 14.48 CPU) @ 690.61/s (n=10000)
to_block: 15.8561 wallclock secs (15.69 usr + 0.05 sys = 15.74 CPU) @ 635.32/s (n=10000)
with: 15.2271 wallclock secs (14.78 usr + 0.07 sys = 14.85 CPU) @ 673.40/s (n=10000)
# 32664d58be4ebfea9c445aa91bac1709e62ce5fa (Class::Accessor::Fast)
Benchmark: timing 10000 iterations of match, match_block, to_block, with...
match: 8.87748 wallclock secs ( 8.79 usr + 0.02 sys = 8.81 CPU) @ 1135.07/s (n=10000)
# Merb-like
use HTTP::Router::Declare;
my $router = router {
# path and params
match '/' => to { controller => 'Root', action => 'index' };
# path, conditions, and params
match '/home', { method => 'GET' } => to { controller => 'Home', action => 'show' };
#!/usr/bin/perl
use strict;
use warnings;
use Hash::Inflator;
use Hash::AsObject;
use Data::OpenStruct::Deep;
use Test::MockObject;
use Benchmark qw(:hireswallclock cmpthese);
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw(:hireswallclock timethese);
use Test::MockObject;
use FindBin::libs;
use HTTP::Router::Declare;
my $router = router {
@masaki
masaki / gist:103040
Created April 28, 2009 09:17
gitosis
# install
cd /tmp
wget http://download.fedora.redhat.com/pub/epel/5/SRPMS/gitosis-0.2-6.20080825git.el5.src.rpm
rpm2cpio gitosis-0.2-6.20080825git.el5.src.rpm | cpio -i gitosis-0.2.tar.gz
tar zxvf gitosis-0.2.tar.gz
cd gitosis-0.2
./setup.py build
sudo ./steup.py install
# post-install
@masaki
masaki / etc_xinetd.d_git-daemon
Created May 8, 2009 09:18
git-daemon w/ xinetd
# default: off
# description: The git daemon allows git repositories to be exported using the git:// protocol.
service git
{
disable = no
type = UNLISTED
port = 9418
socket_type = stream
wait = no
Autotest.add_hook :initialize do |at|
# Version Control
%w[ .svn .git .hg ].each { |exception| at.add_exception(exception) }
# Temporary files
%w[ \.DS_Store #$ ].each { |exception| at.add_exception(%r%#{exception}%) }
# Rails
%w[ log tmp vendor db ].each { |exception| at.add_exception(exception) }
# Reporting
%w[ coverage ].each { |exception| at.add_exception(exception) }
%w[ spec/.+\.opts spec/.+\.html ].each { |exception| at.add_exception(%r%#{exception}%) }
--colour
--format specdoc
--format html:spec/spec_report.html
--loadby mtime
--reverse
--drb
@masaki
masaki / gist:155454
Created July 26, 2009 07:22
rewrite selenium-server.jar enable browser version
gem install webrat -v=0.4.4
# webrat-0.4.4 is not compatible with selenium-client-1.2.15 or higher.
gem install selenium-client -v=1.2.14
cd $GEM_HOME/gems/webrat-0.4.4/vendor
jar xf selenium-server.jar \
customProfileDirCUSTFFCHROME/extensions/readystate\@openqa.org/install.rdf
jar xf selenium-server.jar \
customProfileDirCUSTFFCHROME/extensions/\{538F0036-F358-4f84-A764-89FB437166B4\}/install.rdf