Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / getTextNodeList.js
Created November 1, 2010 16:10
getTextNodeList.js : 対象のDOMノード及び子孫ノードからテキストノードを抽出して配列を返す
/**
* getTextNodeList.js
*
* @version 1.1.7
* @author think49
* @url https://gist.github.com/658424
*/
var getTextNodeList = (function () {
@think49
think49 / natsort-1.2.4.js
Last active November 3, 2017 21:07
natsort.js : 自然順アルゴリズムで配列をソート
/**
* natsort.js
* Sort an array using a "natural order" algorithm.
*
* @version 1.2.4
* @author think49
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @url https://gist.github.com/660141
* @see <a href="http://sourcefrog.net/projects/natsort/">Natural Order String Comparison</a>
*/
@think49
think49 / getFunctionName.js
Created November 5, 2010 16:10
getFunctionName.js : Function#name を取得する
// getFunctionName.js
function getFunctionName (func) {
var functionBody;
functionBody = /^function\s+([^\s(]*)(?=\()/.exec(func.toString());
return functionBody ? functionBody[1] : null; // Function#name || null
}
@think49
think49 / get-primes.js
Created November 13, 2010 13:19
isPrime.js : 素数を判定する / get-primes.js : 素数リストを出力する
/**
* get-primes.js
* Get a prime list.
*
* @version 1.0.1
* @author think49
* @url https://gist.github.com/675313
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / toGreatestCommonDivisor.js
Created November 13, 2010 15:00
toGreatestCommonDivisor.js : 最大公約数を求める (ユークリッドの互除法)
/**
* toGreatestCommonDivisor.js
* @version 1.0
* @author think49
*/
/**
* 最大公約数を求める。(ユークリッドの互除法)
* @function
@think49
think49 / ElementTraversal.js
Created December 9, 2010 12:12
ElementTraversal.js: W3C勧告の ElementTraversal を実装するJavaScriptライブラリ
/**
* ElementTraversal.js
*
* @version 1.0
* @author think49
*/
/**
* Interface Node
@think49
think49 / removeNodesAll.js
Created December 16, 2010 12:48
removeNodesAll.js: 対象のノードリストを全て削除する (deep === true で子要素まで削除する)
/**
* removeNodesAll.js
*
* @version 1.1.1
* @author think49
*/
/**
* Remove NodeList.
* @function
@think49
think49 / Div.js
Created December 28, 2010 16:37
Div.js: new Div で [object HTMLDivElement] を生成するコンストラクタ。new Image の真似。
/**
* Div.js
*
* @version 0.2
* @author think49
*/
/**
* DOM HTMLDivElement constructor.
* @constructor
@think49
think49 / Array.txt
Created December 29, 2010 13:04
[Proxomitron] Array を実装するフィルタ prototype
[Patterns]
Name = "Array [2010/12/02] prototype v0.1.31"
Active = TRUE
Limit = 256
Match = "array"
"$SET(ArrayStatements=var hoge = ["foo","\\"Hello, World!\\"",'test'];)"
"$LST(ArrayCommand)"
Replace = "ArrayCSVLine = $GET(ArrayCSVLine)\r\n"
"ArrayCSV = $GET(ArrayCSV)\r\n"
"\\9 = \9 "
@think49
think49 / addEvent.js
Created December 29, 2010 19:05
addEvent.js: Node#addEventListener, attachEvent のラッパー関数。
/**
* addEvent.js
*
* @version 2.1.3
* @author think49
*/
/**
* removeEventListener wrapper.
* @function