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 max = 10000; | |
var pi = Math.PI; | |
(function() { | |
var a = new Array(max); | |
console.time('native'); | |
for (var i = 0, len = a.length; i < len; i++) { | |
a[i] = pi; |
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
// strict check | |
// | |
function strict() { | |
'use strict'; | |
var isStrict = (function(){return !this}()); | |
console.log(isStrict); | |
} | |
function nonStrict() { |
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 EXArray() { | |
var result = []; | |
result.__proto__ = EXArray.prototype; | |
for (var i = 0, len = arguments.length; i < len; ++i) { | |
result[i] = arguments[i]; | |
} | |
return result; | |
} | |
// どうせなら仕様の範囲内で |
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 AutoPatchWork for Opera | |
// @author os0x, edvakf | |
// @namespace http://ss-o.net/ | |
// @description Automatically loads the next page and inserts into current page when you reach the end of the page. like AutoPagerize. | |
// @license The MIT License | |
// @version 0.2 | |
// @include * | |
// @released 2010-07-07 | |
// @updated 2010-07-07 |
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
// IEでも動くように(実質的には弄ったのはtest4のexecのみ) | |
var r = []; | |
var test = new Date*1; | |
for(var i=0;i<10000;i++){ | |
var src = "http://example.com/lab/test.js" | |
src.substring(0,src.lastIndexOf('/')+1) | |
} | |
r.push(new Date-test); | |
var test2 = new Date*1; |
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 fldr_show_fc2_images.user.js | |
// @namespace http://d.hatena.ne.jp/os0x/ | |
// @description Make fc2 images viewable on LDR/Fastladder | |
// @include http://reader.livedoor.com/reader/ | |
// @include http://reader.livedoor.com/public/* | |
// @include http://fastladder.com/reader/ | |
// ==/UserScript== | |
// via http://gist.github.com/48621 |
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 insertSITEINFO(callback,thisObject){ | |
if (Set.DISABLE_IFRAME && window.parent !== window) return; | |
var src = (Set.SITEINFO_SERVER) ? Set.SITEINFO_SERVER + 'get?url=' + encodeURIComponent(location.href) : 'http://ss-o.net/json/wedataAutoPagerizeSITEINFO.js'; | |
var sc = document.createElementNS(HTML_NAMESPACE, 'script'); | |
sc.type = 'text/javascript'; | |
window.AutoPagerizeCallbackSiteinfo = function(res){ | |
callback.call(thisObject,res); | |
window.AutoPagerizeCallbackSiteinfo = null; | |
sc.parentNode.removeChild(sc); | |
var ev = document.createEvent('Event'); |
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
// 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) { |
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 HTMLStringToDOM(str){ | |
var html = String(str).replace(/<script(?:[ \t\r\n][^>]*)?>[\S\s]*?<\/script[ \t\r\n]*>|<\/?(?:i?frame|html|script|object)(?:[ \t\r\n][^<>]*)?>/gi, ' '); | |
var htmlDoc = document.implementation.createHTMLDocument ? | |
document.implementation.createHTMLDocument('HTMLParser') : | |
document.implementation.createDocument(null, 'html', null); | |
var range = document.createRange(); | |
range.selectNodeContents(document.documentElement); | |
htmlDoc.documentElement.appendChild(htmlDoc.importNode(range.createContextualFragment(html),true)); | |
return htmlDoc; | |
} |
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 favlevel | |
// @namespace http://www.hatena.ne.jp/hitode909/ | |
// @description show favotter level | |
// @include http://twitter.com/* | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
(function(){ | |
var getLoginUser = function() { |
NewerOlder