Skip to content

Instantly share code, notes, and snippets.

@akiym
akiym / git.rb
Created September 11, 2011 12:26
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'
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 {
@akiym
akiym / gist:945998
Created April 28, 2011 08:04
Google CGI API for Japanese Input
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;
@akiym
akiym / gist:945984
Created April 28, 2011 07:50
Amon2::Setup::Flavor::Teng
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 / realtime.pl
Created April 2, 2011 16:10
preview in real-time 2.
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 / markdown.pl
Created April 2, 2011 08:00
preview in real-time.
use Mojolicious::Lite;
use Text::Markdown qw/markdown/;
get '/' => sub {
my $self = shift;
$self->render('index');
};
post '/markdown' => sub {
my $self = shift;
@akiym
akiym / markdown.pl
Created March 31, 2011 15:07
preview Markdown in real-time.
use Mojolicious::Lite;
use Text::Markdown qw/markdown/;
get '/' => sub {
my $self = shift;
$self->render('index');
};
get '/markdown' => sub {
my $self = shift;
@akiym
akiym / _cpanm
Created March 31, 2011 05:54
zsh autcompletion for plackup / cpanm / dzil
#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 / gist:794857
Created January 25, 2011 12:28
Furl
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 / gist:525295
Created August 15, 2010 09:37
Gyazo
#!/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');