Skip to content

Instantly share code, notes, and snippets.

NAKASHIMA, Makoto gifnksm

Block or report user

Report or block gifnksm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gifnksm
gifnksm / nicovideo_getFlv.js
Created Nov 10, 2010
ニコニコ動画でgetFlvを呼び出す関数
View nicovideo_getFlv.js
(function() {
if (!('nicovideo_getFlv' in window)) {
const Getter = function(videoID) {
this._videoID = videoID;
this._callbacks = [];
};
Getter.prototype = {
_videoID: null,
_lock: false,
@gifnksm
gifnksm / .zshrc
Created Oct 25, 2010
ssh-agentをターミナル間で共有する
View .zshrc
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"
@gifnksm
gifnksm / nicovideo_createPanel.js
Created Oct 20, 2010
ニコニコ動画のwatchページのタブを追加する関数
View nicovideo_createPanel.js
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);
@gifnksm
gifnksm / toDOM.js
Created Oct 20, 2010
method toDOM() for XML and XMLList object
View toDOM.js
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;
View jsparsec.js
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) {
@gifnksm
gifnksm / .zshrc
Created Feb 10, 2010
http://blog.fuktommy.com/1159370954 の私家改造版 (~/.ssh/agent-env の実行が不要に)
View .zshrc
function ssh-start() {
eval `/usr/local/bin/ssh-start`
}
[ -e "${HOME}/.ssh/agent-env" ] && . "${HOME}/.ssh/agent-env"
@gifnksm
gifnksm / e4xToDOM.js
Created Feb 8, 2010
E4XからDOMノードへ変換する (HTML用に余分な空白を混入させない)
View e4xToDOM.js
// 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");
View memoize.js
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]);
@gifnksm
gifnksm / joinDOM.js
Created Feb 8, 2010
DOM要素の配列を結合する
View joinDOM.js
// 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');
@gifnksm
gifnksm / bookmark.css
Created Feb 2, 2010
ブックマークツールバーのテキストラベルを隠すユーザースタイル
View bookmark.css
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#bookmarksBarContent toolbarbutton:not([container="true"]) label {
display: none !important;
}
#bookmarksBarContent toolbarbutton:not([container="true"]) image {
margin: 0 !important;
}
You can’t perform that action at this time.