Skip to content

Instantly share code, notes, and snippets.

@teramako
teramako / httpstatus.js
Last active December 14, 2015 00:59
[Vimperator]httpstatus コマンドで、HTTP のステータスコードをすばやくしらべる! 一般的な Web Programmer ならば、HTTP Status code はすべて暗記していると聞きました。 しかし、僕はWeb Programmerではないので、なかなか覚えきれていないので、HTTPのステータスコードをさがすのに便利なツールを用意しました。
/**
* @see http://blog.64p.org/entry/2013/02/21/121830
* @see http://mattn.kaoriya.net/software/vim/20130221123856.htm
* @see http://yuroyoro.hatenablog.com/entry/2013/02/21/144004
* @see http://ymotongpoo.hatenablog.com/entry/2013/02/21/160646
* @see http://d.hatena.ne.jp/syohex/20130221/1361423585
* @see http://blog.livedoor.jp/dankogai/archives/51855038.html
* @see http://d.hatena.ne.jp/hasegawayosuke/20130221
* @see https://gist.github.com/tk0miya/5002917
* @see http://app2641.hatenablog.com/entry/2013/02/21/161928
request = require('request')
cheerio = require('cheerio')
iconv = require('iconv-jp')
module.exports = (robot) ->
robot.hear /http(s?):\/\/(.*)/i, (msg) ->
url = msg.match[0]
unless url.match(/\.(png|jpg|jpeg|gif|txt|zip|tar\.bz|js|css)/) # filter out some common files from trying