Skip to content

Instantly share code, notes, and snippets.

View gist:525295
#!/usr/bin/env perl
use Mojolicious::Lite;
use Mojo::Asset::File;
use Digest::MD5 qw(md5_hex);
use File::Spec;
use IO::File;
my $dir = app->home->rel_dir('images');
View gist:794857
use strict;
use warnings;
use Furl;
use LWP::UserAgent;
my $url = 'http://blog.livedoor.jp/dqnplus/';
{
my $furl = Furl->new;
my $res = $furl->get($url);
@akiym
akiym / _cpanm
Created Mar 31, 2011
zsh autcompletion for plackup / cpanm / dzil
View _cpanm
#compdef cpanm
#autoload
typeset -A opt_args
local context state line
_arguments -C \
'(-h)'{-h,--help}'[prints help]' \
'(-v --verobse)'{-v,--verbose}'[turn on chatty output.]' \
'(-q --quiet)'{-q,--quiet}'[turn off the most output.]' \
@akiym
akiym / markdown.pl
Created Mar 31, 2011
preview Markdown in real-time.
View markdown.pl
use Mojolicious::Lite;
use Text::Markdown qw/markdown/;
get '/' => sub {
my $self = shift;
$self->render('index');
};
get '/markdown' => sub {
my $self = shift;
@akiym
akiym / markdown.pl
Created Apr 2, 2011
preview in real-time.
View markdown.pl
use Mojolicious::Lite;
use Text::Markdown qw/markdown/;
get '/' => sub {
my $self = shift;
$self->render('index');
};
post '/markdown' => sub {
my $self = shift;
@akiym
akiym / realtime.pl
Created Apr 2, 2011
preview in real-time 2.
View realtime.pl
use Mojolicious::Lite;
use feature qw/switch/;
use utf8;
use Text::Markdown qw/markdown/;
use Text::Xatena;
use Pod::Simple::XHTML;
get '/' => 'index';
my $xatena = Text::Xatena->new();
@akiym
akiym / gist:945984
Created Apr 28, 2011
Amon2::Setup::Flavor::Teng
View gist:945984
use strict;
use warnings;
use utf8;
package Amon2::Setup::Flavor::Teng;
use parent qw(Amon2::Setup::Flavor::Basic);
sub run {
my $self = shift;
@akiym
akiym / gist:945998
Created Apr 28, 2011
Google CGI API for Japanese Input
View gist:945998
use strict;
use warnings;
use Encode;
use JSON;
use LWP::UserAgent;
use URI;
use Data::Dumper;
use Data::Recursive::Encode;
my $text = shift or die;
View webquery-first.pl
use strict;
use warnings;
use Web::Query;
my $elem = wq('http://ch.nicovideo.jp/channel/ch60001')
->find('ul.g-video-mini .g-video-right');
$elem->{trees} = [$elem->{trees}[0]];
$elem->each(sub {
View git.rb
require 'formula'
class GitManuals < Formula
url 'http://ftp.jaist.ac.jp/pub/Linux/kernel.org/software/scm/git/git-manpages-1.7.6.1.tar.bz2'
md5 'cae559424a62507cb2c15252d85a158e'
end
class GitHtmldocs < Formula
url 'http://ftp.jaist.ac.jp/pub/Linux/kernel.org/software/scm/git/git-htmldocs-1.7.6.1.tar.bz2'
md5 'f698e0abbf1555582e30320930391c59'