Skip to content

Instantly share code, notes, and snippets.

@rentan
rentan / re.dms
Created August 7, 2015 13:45
get capture in global regexp matching
re = new RegExp('a(.)','g');
a = 'akgatranavayakhahjajatdaa';
//b = re.exec(a);
//for(i in b)alert(????);
var results = [ ];
a.replace (re, function (s, p1) {
results.push ([ s, p1 ]);
return '';
});
@rentan
rentan / ngnl_janken_quick.user.js
Created June 10, 2014 10:38
アレのアレをアレするアレ。
// ==UserScript==
// @name ngnl_janken_quick.user.js
// @description ノーゲームノーライフじゃんけんゲーム 高速化
// @version 20140610.0
// @namespace http://rentan.org/
// @author rentan
// @grant none
// @include http://www.ngnl-janken.com/
// ==/UserScript==
var customMatchers = {
toStartWith: function (util, customEqualityTesters) {
return {
compare: function (actual, expected) {
return { pass: actual.slice (0, expected.length) === expected };
}
};
}
};