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 maketable() { | |
var retstr = "<table><tr>"; | |
return function(s, f) { | |
if (!s) return retstr; | |
retstr += "<td>" + s + "</td>"; | |
if (f) { |
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
/* | |
Google ChromeでNotifications APIを利用するための簡易ライブラリ | |
*/ | |
Notification = { | |
initialized : false, | |
NOT_ALLOWED : 1, | |
NOT_SUPPORTED : 2, | |
//初期化(標準仕様に準拠させる)利用前に必ず実行する |
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 choose(arr, dup, len) { | |
var retarr = [], i, n, group = {}, gpos, p; | |
arr = clone(arr); | |
dup = !!dup; | |
len = len || arr.length; | |
function sub(arr, buf) { | |
var i, c, subarr, subbuf; | |
for (i = 0; i < arr.length; i++) { | |
subarr = clone(arr); |
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 combination(array, len) { | |
var buf = [], retarr = []; | |
function sub(arr, buf) { | |
var subarr, subbuf; | |
var max = arr.length - (len - buf.length); | |
for (var i = 0; i < arr.length; i++) { | |
subarr = arr.slice(); | |
subbuf = buf.slice(); | |
subbuf.push(subarr[i]); | |
subarr.splice(0, i + 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
function parseString2DOM(str) { | |
var xmlDoc; | |
if (window.ActiveXObject) { | |
xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); | |
xmlDoc.async = false; | |
xmlDoc.loadXML(str); | |
} else { | |
parser = new DOMParser(); | |
xmlDoc = parser.parseFromString(str, "text/xml"); | |
} |
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 format() { | |
var args, fmt, result; | |
args = Array.prototype.slice.apply(arguments); | |
fmt = this instanceof String ? this : args.shift(); | |
if (args.length === 1 && typeof args[0] === "object") { | |
args = args[0]; | |
} |
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
javascript:(function () {var t=document.evaluate("//text()",document,null,7,null);for(var i=0;i<t.snapshotLength;i++)t.snapshotItem(i).nodeValue=t.snapshotItem(i).nodeValue.replace(/いいね/gi,"くたばれ");})(); |
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 f = 20, b = document.body; | |
setInterval(function () { | |
b.style.marginLeft = f + 'px'; | |
f = -f; | |
}, 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
function sleepsort(arr, callback) { | |
var res = []; | |
$.when.apply($, a.map(function (n) { | |
var dfd = $.Deferred(); | |
setTimeout(function () { | |
res.push(n); | |
dfd.resolve(); | |
}, n); |
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
# Module Dependencies | |
express = require 'express' | |
app = module.exports = express.createServer() | |
# Configuration | |
app.configure -> | |
app.set 'views', __dirname + '/views' |
OlderNewer