Skip to content

Instantly share code, notes, and snippets.

View kentaro's full-sized avatar

Kentaro Kuribayashi kentaro

View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use Term::ANSIColor::Markup;
my %options;
GetOptions(
'flush' => \$options{flush},
#!/usr/bin/env plackup --port 5432 -E production
# vim:set ft=perl:
package Plack::App::CocProxy;
use strict;
use warnings;
use parent qw(Plack::App::File);
use Plack::App::Proxy;
my $proxy = Plack::App::Proxy->new->to_app;
@kentaro
kentaro / gist:933719
Created April 21, 2011 04:28
Reload browser when static files get modified
# ... snip ...
{
use Plack::Loader::Restarter;
no warnings 'redefine';
my $orig = \&Plack::Loader::Restarter::_fork_and_start;
*Plack::Loader::Restarter::_fork_and_start = sub {
my ($self, $server) = @_;
my $restart = exists $self->{pid};
@kentaro
kentaro / gist:982412
Created May 20, 2011 05:33
sleep-sort
(require 'deferred)
(defun sleep-sort (list)
(mapc (lambda (i)
(lexical-let ((sec i))
(deferred:$
(deferred:wait (* sec 1000))
(deferred:nextc it
(lambda ()
(princ (format "%d\n" sec)))))))
poe-
@kentaro
kentaro / gist:1106028
Created July 26, 2011 05:15
Alarm::setTimeout
#!/usr/bin/env perl
use strict;
use warnings;
package Alarm::setTimeout;
use strict;
use warnings;
my @handlers;
$SIG{ALRM} = sub {
@kentaro
kentaro / gist:1117661
Created August 1, 2011 06:33
Dancer with Config::ENV
#!/usr/bin/env perl
use strict;
use warnings;
package MyConfig;
use Config::ENV 'FOO_ENV';
package main;
use Dancer ':syntax';
BEGIN { MyConfig->import }
~/.emacs.d/elisp
$ perlbrew install 5.14.1
The given directory 5.14.1 is not a git checkout of perl repository. To
brew a perl from git, clone it first:
git clone git://github.com/mirrors/perl.git
perlbrew install perl
@kentaro
kentaro / gist:1167734
Created August 24, 2011 10:21
Semantic False Class
package main;
use strict;
use warnings;
package SemanticFalse;
use strict;
use warnings;
use overload bool => sub {
my $self = shift;
@kentaro
kentaro / gist:1267686
Created October 6, 2011 15:28
『エジプト詩集』
* 便所の光景
額から胸へと、大きな弧を成し、身を反り出し、
いちはやく唇が嘴へ、やや遅れて突き出た胸には、白い綿毛。
エジプトの女王は、いまにも空へ舞い上がろうとしている。
勇壮さでもって、きたるべき敗退の予感を押し隠す
戦士の瞳は、かすかに潤んでいる。
地中海に散りばめられた宝石。
蠅をとらえる。
黒色の夜が空を千に裂いて、女たちに埋め込んでいく。