Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / multidimensional-map-1.0.0.js
Last active July 19, 2017 11:20
multidimensional-map.js : 多次元Mapを生成
/**
* multidimensional-map.js
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/00326b750d48f5f9c48a042f1b19a1c2
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
function createMultidimensionalMap (mapData) {
@think49
think49 / es6-object-assign.js
Last active August 23, 2017 08:01
Object.assign(): オブジェクトをシャローコピー(ES6 Polyfill)
/**
* es6-object-assign.js
*
* Object.assign( target, ...sources )
* The assign function is used to copy the values of all of the enumerable own properties from one or more source objects to a target object. When the assign function is called, the following steps are taken. (ECMA-262 6th Edition / ECMAScript 2015)
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/a615978e85f44cb0ef5c7cbdd3cca942
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
@think49
think49 / deep-copy-object.js
Last active August 23, 2017 08:28
deep-copy-object.js: オブジェクトをディープコピー
/**
* deep-copy-object.js
*
* Deep copy objects.
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/96e8fc064b917287cadb1dfacc39695c
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / json-for-date-1.0.2.js
Last active September 17, 2021 03:05
json-for-date.js: DateオブジェクトをJSON拡張形式にシリアライズ/パースの相互変換
/**
* json-for-date-1.0.2.js
* JSON which can serialize Date object
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/think49/26fcddaaa63cd0d6b27de8ef9c514c41
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / Webブラウザのウインドウのスクロール量を取得する.md
Last active October 4, 2021 03:29
Webブラウザのウインドウのスクロール量を取得する.md
@think49
think49 / readme.md
Last active September 13, 2017 08:14
toISOLocalString(): 現在のロケールに対応した「ISO 8601 拡張形式」の日付文字列を返します

to-iso-local-string.js

概要

現在のロケールに対応したISO 8601 拡張形式の日付文字列を返します。 現在のロケールが UTC (協定世界時) であるなら、Date.prototype.toISOString() と同じ文字列を返します。

使い方

@think49
think49 / create-square-aa-1.0.1.js
Last active February 2, 2019 06:24
create-square-aa.js: 四角形のASCII Artを生成する
/**
* create-square-aa-1.0.1.js
* create ASCII art square.
*
* @version 1.0.1
* @author think49
* @url https://gist.github.com/think49/2a30b4e865f3dca4043440fb9b99a448
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / readme.md
Last active October 1, 2017 16:58
string-prototype-includes.js: String.prototype.includes の Polyfill (ECMAScript 2017 準拠)

string-prototype-includes.js

概要

ECMAScript 2015 (ECMA-262 6th Edition) から既定の String.prototype.includes の Polyfill(互換コード)を提供します。 (ES6 で作られたメソッドですが、参考にした仕様は ECMAScript 2017 (ES8) になります。)

使い方

@think49
think49 / [JavaScript] Number 型に変換する方法まとめ.md
Created October 2, 2017 14:13
[JavaScript] Number 型に変換する方法まとめ

Number 型に変換する方法まとめ

ECMAScript 2017

ECMAScript とは JavaScript の根幹となる仕様の名称です。 型変換は ECMAScript 仕様に準じており、ここでは ECMAScript 2017 に沿った説明をしています。

数値リテラル (NumericLiteral)

ECMAScript 2017 では Number 型を表すリテラル表現として、NumericLiteral の文法を定義しており、NumericLiteral は更に次の4種類に分かれます。

@think49
think49 / nodelist-prototype-foreach-1.0.0.js
Last active October 29, 2017 12:12
nodelist-prototype-foreach.js: Web IDL 既定の NodeList.prototype.forEach の Polyfill(互換コード)
/**
* nodelist-prototype-foreach.js
* The forEach() method of the NodeList interface calls the callback given in parameter once for each value pair in the list, in insertion order.
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/df8c54a9aa421db3b650a3c1cab9b4a9
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="https://heycam.github.io/webidl/#es-forEach">3.6.9.2. forEach - Web IDL</a>
*/