This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* gcd(a, b) { | |
[a, b] | |
if (a < b) { | |
var t = a; | |
a = b; | |
b = t; | |
} | |
do { | |
r = a % b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main(void) { | |
int n; | |
int employees[4000] = {0}; | |
while (1) { | |
scanf("%d", &n); | |
if (!n) break; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GMEasyInstall | |
// @namespace http://d.hatena.ne.jp/javascripter/ | |
// @include http* | |
// ==/UserScript== | |
function fixLink(doc) { | |
$$('a[href$=".user.js"]', doc) | |
.forEach(function(a) { | |
a.href += "#"; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MDCJa2En | |
// @namespace http://d.hatena.ne.jp/javascripter/ | |
// @include http://developer.mozilla.org/ja/* | |
// ==/UserScript== | |
function ja2en(doc) { | |
Array.forEach(doc.getElementsByClassName('new'), | |
function(a) { | |
a.href = a.href.replace("ja","en"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SmartLDR | |
// @namespace http://d.hatena.ne.jp/javascripter/ | |
// @include http://reader.livedoor.com/reader/ | |
// ==/UserScript== | |
function evalInPage(fun) { | |
location.href = "javascript:void (" + fun + ")()"; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function $N(name, a) | |
[[i == "className" ? "class": i, a[i]] | |
for (i in a) if (a.hasOwnProperty(i))] | |
.reduce((function(elem, [attr, value]) | |
(elem.setAttribute(attr, value), elem)), | |
document.createElement(name)); | |
$N("div", {className: "foo", id: "bar"}); // <div id="bar" class="foo"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.bind = function bind() { | |
var args = Array.slice(arguments), | |
thisObj = args.shift(), | |
self = this; | |
return function () | |
self.apply(thisObj, args.concat(Array.slice(arguments))); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name NicoVideoAutoPlay | |
// @namespace http://d.hatena.ne.jp/javascripter/ | |
// @include http://www.nicovideo.jp/watch/* | |
// ==/UserScript== | |
location.href = "javascript:" + function () { | |
var flvplayer = document.getElementById("flvplayer"); | |
(function play() { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var last = null; | |
(function request() { | |
with (new XMLHttpRequest()) { | |
open('get', location.href, true); | |
send(null); | |
onload = function () { | |
if (!last || last == this.responseText) { | |
last = this.responseText; | |
setTimeout(request, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name All bbeta | |
// @namespace http://d.hatena.ne.jp/javascripter/ | |
// @include http* | |
// ==/UserScript== | |
function replace(parent) { | |
Array.forEach( | |
parent.querySelectorAll('a[href^="http://b.hatena.ne.jp/"]'), | |
function (elem) { |
OlderNewer