Skip to content

Instantly share code, notes, and snippets.

View cho45's full-sized avatar

Satoh, Hiroh cho45

View GitHub Profile
nnoremap epp a<C-R>=join(split(substitute(expand("%:p"), '.*lib/\\|.pm$', "", "g"), "/"), "::")<CR>
sub unindent ($) {
my ($str) = @_;
$str =~ /^\n*(\s+)/;
if ($1) {
my $indent = $1;
$str =~ s/$indent//g;
}
$str;
}
@cho45
cho45 / post.js
Created August 7, 2008 14:55
ダイアリの編集API適当にたたく
var url = "http://cho45.g.hatena.ne.jp/cho45/";
var s = {};
next(function getRkm () {
return xhttp.get(url).
next(function (r) {
s.rkm = r.responseText.replace(/^[\S\s]*Hatena\.rkm\s*=\s*(?:'([^']+)'|"([^"]+)")[\S\s]*$/, function (_, v1, v2) {
return v1 || v2;
});
});
@cho45
cho45 / hatena-multi.uc.js
Created August 15, 2008 15:20
はてなアカウント
/**
* Multi login for Hatena
* cho45 <cho45@lowreal.net>
* 2007-10-15
*
* License:
* Creative Commons by
* http://creativecommons.org/licenses/by/3.0/
*
* Using information in your password manager,
@cho45
cho45 / ldr list
Created August 15, 2008 16:38
選択したフィードの link と title をタブ区切りで
// http://reader.livedoor.com/share/
// 選択したフィードの link と title を OPML で
// Firebug で実行
var opml =
<opml version="1.0">
<head>
<title>from ldr share</title>
</head>
<body>
@cho45
cho45 / new screen with cd
Created August 21, 2008 16:17
new screen window with cd
# 新しく screen window をつくり、カレントディレクトリを実行元のディレクトリに
function n () {
screen -X eval "chdir $PWD" "screen" "chdir"
}
#!js
Object.prototype.p = function () {
print(uneval(this));
return this;
};
function merge (a, b) {
var ret = new Array(a.length + b.length);
a = a.concat(Infinity); // clone the array and append sentry
$X(".//a[@class='username']/img[@title]").forEach(function (e) {
e.parentNode.appendChild(document.createTextNode(" [id:" + e.title + "]"));
});
@cho45
cho45 / erinnnotice.rb
Created September 15, 2008 13:27
エリン時間予告
#!/usr/bin/env ruby
require "rubygems"
require "snarl"
def message(str)
Snarl.show_message("mabinogi", str, nil, 10) # 日本語で最後の1文字がおかしい。snarl sucks
end
message "エリン時間予告を起動しました。"
@cho45
cho45 / エロゲといえば
Created September 27, 2008 17:58
エロゲといえば
CROSS†CHANNEL
果てしなく青いこの空の下で…。
明日の君と逢うために
ゆのはな
CARNIVAL
グリーングリーン
ユメミルクスリ
そして明日の世界より─
桜華
カタハネ