LoginSignup
5
4

More than 5 years have passed since last update.

TwitterAPI のURL補完 snippetファイル作った

Posted at

statuses/update とか users/show とか毎回打ち込んだりコピペは面倒なので

こちら補完用 snippet ファイル
https://gist.github.com/elzzup/9d5e2725356f94419513

ちなみにこちら snippet フィイル生成したPHPスクリプト

generate_snippets.php
<?php
/*
 * TwitterAPI1.1 url snippets 生成
 */
require_once('./simple_html_dom.php');

/*【保存版】TwitterAPI1.1 REST API 全項目解説 | DX.univ */
$url = 'http://dx.24-7.co.jp/twitterapi1-1-rest-api/';

$html = file_get_html($url);
foreach ($html->find('tr') as $tr) {
    if (!$tr->find('td', 0) || !($tr->find('td', 0)->find('a'))) {
        continue;
    }
    list($td1, $td_disc) = $tr->find('td');
    list($method, $query_base) = explode(' ', $td1->find('a', 0)->innertext);
    $query = $query_base;
    $discription = $td_disc->innertext;
echo <<<EOF
snippet     $query
abbr        $discription
options     word
    $query_base\n\n
EOF;
}

VIMで使いたいならば
twitter.snip を ~/.vim/snippets に入れて
補完したいfiletype のフォルダからリンクを貼るなりすれば

<<< hiro@arch~/.vim/snippets
>>> cd php
php.snip*  php_functions.snip*
<<< hiro@arch~/.vim/snippets/php
>>> ln ../twitter.snip ./ 
`./twitter.snip' => `../twitter.snip'

blog.png

こんな感じで使える

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4