Skip to content

Instantly share code, notes, and snippets.

View ohnishiakira's full-sized avatar

Akira Ohnishi ohnishiakira

View GitHub Profile
@ohnishiakira
ohnishiakira / gist:1052388
Created June 28, 2011 22:17
JavaScriptでURLのドメインの部分だけ抜き出す
var url = "http://example.com/";
var re = /https?:\/\/([^/]*)\//i;
url.match(re); // ["http://example.com", "example.com"]
@ohnishiakira
ohnishiakira / diff
Created July 12, 2011 07:58
diff -Ebw jquery.csvToTable.js.orig jquery.csvToTable.js
52a53
>
57a59
>
69,70c71
< }
< else if (x) {
---
> } else if (x) {
72,81c73,75
@ohnishiakira
ohnishiakira / togetter-auto-more.user.js
Created July 19, 2011 08:47
togetterの"続きを読む"を自動でクリック
// ==UserScript==
// @match http://togetter.com/li/*
// ==/UserScript==
(function (element) {
if (element !== null) {
var event = document.createEvent("MouseEvents");
event.initEvent("click", false, true);
element.dispatchEvent(event);
}
@ohnishiakira
ohnishiakira / gist:1096600
Created July 21, 2011 05:59
.bashrcとかにこんな風に書いておくと手軽にスクリーンロックできて便利
alias slck="/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine"
@ohnishiakira
ohnishiakira / force-external-link-on-new-tab.user.js
Created July 24, 2011 05:11
外部リンクを自動で新しいタブで開く
@ohnishiakira
ohnishiakira / twitter-auto-reload.user.js
Created July 25, 2011 16:38
Twitter.comの更新(.)を自動でやる
// ==UserScript==
// @match *://twitter.com/*
// ==/UserScript//
(function() {
setInterval(function() {
jQuery.event.trigger({type: "keypress", which: 0x2e});
}, 10000);
});
@ohnishiakira
ohnishiakira / gist:1115759
Created July 30, 2011 17:14
earthquakeが落ちた時のエラーログ
⚡ /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/twitter-stream-0.1.14/lib/twitter/json_stream.rb:121:in `<<': Could not parse data entirely (HTTP::Parser::Error)
from /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/twitter-stream-0.1.14/lib/twitter/json_stream.rb:121:in `receive_data'
from /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/earthquake-0.7.5/lib/earthquake/core.rb:102:in `start'
from /home/akira/.rvm/gems/ruby-1.9.2-p290/gems/earthquake-0.7.5/bin/earthquake:40:in `<main>'
@ohnishiakira
ohnishiakira / .gemrc
Created August 1, 2011 03:13
.gemrcの書き方
# 普段はこう書いている
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
search: --remote
specification: --remote
@ohnishiakira
ohnishiakira / gist:1124632
Created August 4, 2011 06:57
vimiumの設定
# Scroll step size
60px
# Exclude URLs
http*://twitter.com/*
http*://gmail.google.com/*
http://b.hatena.ne.jp/viewer
http*://reader.livedoor.com/*
# Key mappings
@ohnishiakira
ohnishiakira / mousetracker.js
Created August 29, 2011 06:08
DevTools上で実行するとマウスポインタの脇に座標が表示できて便利
// ==UserScript==
// @match *://*/*
// ==/UserScript==
(function() {
var style = "font-size: 12px;";
var div = document.createElement("div");
document.body.appendChild(div);
document.addEventListener("mousemove", function(e) {
var x = e.pageX + 5, y = e.pageY + 5;