Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / get-type.js
Created March 9, 2011 12:04
get-type.js : ECMAScript5 準拠のデータ型を返す
/**
* get-type.js
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/862085
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
function getType (value) {
@think49
think49 / get-class.js
Created March 9, 2011 12:15
get-class.js : [[Class]] を返す (ECMAScript5準拠)
/**
* get-class.js
*
* @version 1.0.4
* @author think49
* @url https://gist.github.com/862098
*/
function getClass (arg) {
var _class;
@think49
think49 / compatible-event.js
Last active September 25, 2015 07:07
compatible-event.js : addEventListener, attachEvent のラッパー関数。addEvent したリスナーは window unload 時に削除される(循環参照対策)。attachEvent でも実行順が保証される。
/**
* compatible-event.js
*
* @version 0.9.4b
* @author think49
* @url https://gist.github.com/882821
*/
'use strict';
@think49
think49 / textareaSelectEndPoint.js
Created March 24, 2011 12:57
textareaSelectEndPoint.js : テキストボックスにフォーカスした時、文字列の最後にカーソルが移動させる。(IE8 はデフォルトでカーソルが先頭に移動する)
/**
* textareaSelectEndPoint.js
*
* @version 1.0.4
* @author think49
* @url https://gist.github.com/885009
*/
(function () {
@think49
think49 / is-object.js
Last active September 25, 2015 07:47
is-object.js : Object型なら true を返し、他の型なら false を返す(ES6対応)
/**
* is-object.js
*
* @version 1.0.3
* @author think49
* @url https://gist.github.com/887049
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
'use strict';
@think49
think49 / natural-language.js
Created March 27, 2011 08:13
natural-language.js : 自然言語アルゴリズムで配列やノードリストをソートする
/**
* natural-language.js
* Array is sorted by natural language algorithm.
*
* @version 0.9
* @author think49
* @url https://github.com/think49
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://sourcefrog.net/projects/natsort/">Natural Order String Comparison</a>
*/
@think49
think49 / to-zero-padding.js
Created March 29, 2011 08:14
to-zero-padding.js : 数値をゼロパディングされた数値文字列に変換する
/**
* to-zero-padding.js
* The Number value is changed to the numerical string value of zero padding.
*
* @version 1.1.1
* @author think49
* @url https://gist.github.com/891983
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / cssstyledeclaration-removeproperty.js
Last active June 7, 2017 04:05
cssstyledeclaration-removeproperty.js, cssstyledeclaration-setproperty.js : IE8- で動作する CSSStyleDeclaration#removeProperty, CSSStyleDeclaration#setProperty
/**
* cssstyledeclaration-removeproperty.js
* define CSSStyleDeclaration.prototype.removeProperty for IE.
*
* @version 1.0.4
* @author think49
* @url https://gist.github.com/953107
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface">5.5.1. The CSSStyleDeclaration Interface - CSSOM</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/dd347052%28v=vs.85%29.aspx">CSSStyleDeclaration Prototype (attribute) - MSDN</a>
@think49
think49 / to-hankaku.js
Created May 10, 2011 14:38
to-hankaku.js, to-zenkaku.js : 半角文字/全角文字をそれぞれ変換する
/**
* to-hankaku.js
* convert to ascii code strings.
*
* @version 1.0.1
* @author think49
* @url https://gist.github.com/964592
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / translate-by-array.js
Created May 11, 2011 09:54
translate.js : XPath の translate() 関数。
/**
* translate-by-array.js
* translate function of XPath.
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/966219
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://www.w3.org/TR/xpath/#function-translate">translate() - XML Path Language (XPath)</a>
*/