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
Data = { | |
count: Integer, // タグの個数 | |
first: Date, // タグ情報を最初に取得した日時 | |
last: Date, // タグ情報を最後に取得した日時 | |
tags: [Tag] // タグ情報の配列 | |
}; | |
Tag = { | |
id: Integer, // タグのID | |
name: String, // タグ名 |
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() { | |
if (!('nicovideo_getFlv' in window)) { | |
const Getter = function(videoID) { | |
this._videoID = videoID; | |
this._callbacks = []; | |
}; | |
Getter.prototype = { | |
_videoID: null, | |
_lock: false, |
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 ssh-start() { | |
ssh-agent -s > "${HOME}/.ssh/agent-env" | |
. "${HOME}/.ssh/agent-env" | |
ssh-add | |
} | |
if [ -e "${HOME}/.ssh/agent-env" ]; then | |
isAliveAgent=`ps -ef | grep "/ssh-agent" | grep -v grep | wc -l` | |
if [ $isAliveAgent = 1 ]; then | |
echo "ssh-agent is alive" |
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 nicovideo_createPanel(id, labelText) { | |
let panelID = 'itab_' + id; | |
let label = document.createElement('a'); | |
label.href = '#' + panelID; | |
label.innerHTML = '<div>' + labelText + '</div>'; | |
// remove extra <a>...</a> | |
label.firstChild.textContent = labelText; | |
document.querySelector('#itab td').appendChild(label); |
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
default xml namespace = "http://www.w3.org/1999/xhtml"; | |
(function() { | |
var parser = new DOMParser(), | |
range = document.createRange(); | |
function toDOM(xmlns) { | |
var pretty = XML.prettyPrinting; | |
// disable prettyPringing temporary to avoid extra space inclusion | |
XML.prettyPrinting = false; |
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
var Combinator = function(fun) { | |
if (typeof fun === 'function') | |
this.parse = fun; | |
}; | |
Combinator.define = function(fun) { | |
var c = new this(); | |
fun.call(c); | |
return c; | |
}; | |
Combinator._rjoin = function(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 ssh-start() { | |
eval `/usr/local/bin/ssh-start` | |
} | |
[ -e "${HOME}/.ssh/agent-env" ] && . "${HOME}/.ssh/agent-env" |
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
// XML (E4X)からDOM Nodeへの変換 | |
default xml namespace = "http://www.w3.org/1999/xhtml"; | |
function e4xToDOM(xml, xmlns) { | |
var pretty = XML.prettyPrinting; | |
// 余分な空白を混入させないように,prettyPrintingを一時的に無効にする | |
XML.prettyPrinting = false; | |
var doc = (new DOMParser).parseFromString( | |
'<root xmlns="' + xmlns + '">' + xml.toXMLString() + "</root>", | |
"application/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
Object.memoize = function(obj, defs) { | |
function add(key, getter) { | |
obj.__defineGetter__(key, function() { | |
delete this[key]; | |
return this[key] = getter.call(this); | |
}); | |
} | |
for (let key in defs) { | |
if (defs.hasOwnProperty(key)) { | |
add(key, defs[key]); |
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
// DOM要素を結合する。引数はScalaのmkString風 | |
Array.prototype.joinDOM = function() { | |
var [sep, head, tail] = [null, null, null], | |
arg = Array.map(arguments, convertToDOM); | |
switch(arg.length) { | |
case 0: break; | |
case 1: [sep] = arg; break; | |
case 3: [head, sep, tail] = arg; break; | |
default: throw new Error('invalid arguments'); |