Skip to content

Instantly share code, notes, and snippets.

@satyr
satyr / gist_logs.user.js
Created May 6, 2009 22:13
Shows commit logs on Gist.
// ==UserScript==
// @name gist logs
// @namespace http://d.hatena.ne.jp/murky-satyr
// @description Shows commit logs on Gist.
// @include https://gist.github.com/*
// @license WTFPL
// ==/UserScript==
Array.forEach(document.querySelectorAll('#revisions .id'), function(a){
GM_xmlhttpRequest({
method: 'get', url: 'https://raw.github.com/gist'+ a.pathname +'/meta',
@os0x
os0x / addDefaultPrefix.js
Created September 10, 2009 03:44 — forked from cho45/dollarX.js
$X on XHTML and Cross Browser
// XPath 式中の接頭辞のない名前テストに接頭辞 prefix を追加する
// e.g. '//body[@class = "foo"]/p' -> '//prefix:body[@class = "foo"]/prefix:p'
// http://nanto.asablo.jp/blog/2008/12/11/4003371
function addDefaultPrefix(xpath, prefix) {
var tokenPattern = /([A-Za-z_\u00c0-\ufffd][\w\-.\u00b7-\ufffd]*|\*)\s*(::?|\()?|(".*?"|'.*?'|\d+(?:\.\d*)?|\.(?:\.|\d+)?|[\)\]])|(\/\/?|!=|[<>]=?|[\(\[|,=+-])|([@$])/g;
var TERM = 1, OPERATOR = 2, MODIFIER = 3;
var tokenType = OPERATOR;
prefix += ':';
function replacer(token, identifier, suffix, term, operator, modifier) {
if (suffix) {
// ==UserScript==
// @name check-userjs
// @namespace http://www.hatena.ne.jp/hitode909
// @include http://*
// @include https://*
// ==/UserScript==
var anchors = document.querySelectorAll('a[href$=".js"]');
for (var i = 0, len = anchors.length; i < len; i++) {
@nanto
nanto / convertToHTMLString.js
Created February 5, 2010 00:09
covertToHTMLString
// Original code by Constellation
// http://d.hatena.ne.jp/Constellation/20100203/1265207970
function convertToHTMLString(source, safe) {
if (!source || (source.getRangeAt && source.isCollapsed)) return '';
var range = source.getRangeAt ? source.getRangeAt(0) : null;
var node = range ? range.cloneContents() : source.cloneNode(true);
if (safe) {
var root = range && range.commonAncestorContainer.cloneNode(false)
if (!root || root.nodeType !== root.ELEMENT_NODE)
@hitode909
hitode909 / kurukuruwidow.user.js
Created February 10, 2010 04:44
ノートパソコンを縦にするとページが回転する
// ==UserScript==
// @name kurukuruwindow
// @namespace http://www.hatena.ne.jp/hitode909
// @include *
// ==/UserScript==
(function() {
try { if (window != window.parent) return } catch(e) { return };
var lowPass = { x: 0.0, y: 0.0, z: 0.0 };
@hitode909
hitode909 / u.sh
Created February 10, 2010 12:40
リポジトリのtopにcdする
# リポジトリのトップレベルにcd
function u()
{
cd ./$(git rev-parse --show-cdup)
}
// ==UserScript==
// @name Hatena::Star Waste Color Star
// @namespace http://lowreal.net/
// @include *
// @require http://github.com/cho45/jsdeferred/raw/master/jsdeferred.userscript.js
// ==/UserScript==
//
(function () { with (D()) {
setTimeout(function () {
// http://gist.github.com/raw/315047/e07932e73fb928365425f13bd7376a43b8433071/patchworkinput.txt を開いた状態で、Chromeのコンソールで実行
// かなり無駄を省きました… 速度はV8 2.1.0.1 で Quad Core 2.66GHzで360msくらい
//* この行の先頭の/で使用するデータ切り替えます
var text=[
'ABAAAABBBA',
'ABABABABBB',
'BABBBAABBA',
'ABBABBBBBB',
'BBABABAAAB',
@hitode909
hitode909 / auto-imenu.user.js
Created March 4, 2010 08:48
ime.nu勝手に遷移する
// ==UserScript==
// @name auto-imenu
// @namespace http://www.hatena.ne.jp/hitode909
// @include http://ime.nu/*
// ==/UserScript==
location.replace(document.querySelector('a').href);