Skip to content

Instantly share code, notes, and snippets.

@sugyan sugyan/カンペ.md
Last active Dec 15, 2015

Embed
What would you like to do?
  • amon2-setup.plでプロジェクト作成
  • carton installする
  • heroku create --buildpack http://github.com/sugyan/heroku-buildpack-perl.git
  • git push
  • template 編集 login
  • Amon2::Auth::Site::Github
  • cpanfile に依存追記、carton install
  • plugin 追加
  • github app 作成
  • config 設定
  • form 作成
  • DBI
    $c->dbh->do(
        'INSERT INTO entry (user_name, body, created_on) VALUES (?, ?, ?)',
        undef,
        $c->session->get('name'), $body, time(),
    );

    my $entries = $c->dbh->selectall_arrayref(
        'SELECT * FROM entry ORDER BY created_on DESC',
        { Slice => {} },
    );
  • TZ=Asia/Tokyo
  • DBD::Pg追加
  • pg.sql用意
  • heroku addons:add heroku-postgres
  • id SERIAL
    use URI::Split qw(uri_split);
    my ($scheme, $auth, $path, $query, $frag) = uri_split($ENV{HEROKU_POSTGRESQL_BLUE_URL});
    my ($userpass, $hostport) = split '@', $auth;
    my ($user, $pass) = split ':', $userpass;
    my ($host, $port) = split ':', $hostport;
    my $dbname = substr $path, 1;
  • WebService::YahooJapan::WebMA
    app_id => '********************************************************************************',

    $WebService::YahooJapan::WebMA::APIBase = 'http://jlp.yahooapis.jp/MAService/V1/parse';

    my $api = WebService::YahooJapan::WebMA->new(
        appid => $c->config->{Yahoo}{app_id},
    );
    my $result = $api->parse(sentence => $body) or die;
    my $str = '';
    for my $word (@{ $result->{ma_result}{word_list} }) {
        if ($word->{pos} eq '動詞') {
            $str .= '全裸で'
        }
        $str .= $word->{surface};
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.