Skip to content

Instantly share code, notes, and snippets.

@uupaa
uupaa / Test.js fragement code.md
Created May 22, 2015 20:41
Test.js fragement code
Test["toHex"]      = Test_toHex;        // Test#toHex(a:TypedArray|Array, fixedDigits:Integer = 0):NumberStringArray
Test["likeArray"]  = Test_likeArray;    // Test#likeArray(a:TypedArray|Array, b:TypedArray|Array, fixedDigits:Integer = 0):Boolean
Test["likeObject"] = Test_likeObject;   // Test#likeObject(a:Object, b:Object):Boolean


function Test_toHex(a,             // @arg TypedArray|Array
                    fixedDigits) { // @arg Integer = 0 - floatingNumber.toFixed(fixedDigits)
                                   // @arg NumberStringArray - ["00", "01"]                  (Uint8Array)
                                   //                          ["0000", "0001", ...]         (Uint16Array)
@uupaa
uupaa / homebrew_node_io_on_mac.md
Last active August 29, 2015 14:21
WebModule install process (brew + io.js 環境構築)

homebrew を使い、 node, npm と iojs の最新をインストールし、利用できるようにしてみましょう。

$ brew install node             // 一緒に npm もインストールされます

$ node --version
> v0.12.2

$ npm --version
> 2.10.0

MAC と Bluetooth でペアリングし、ブラウザから keyCode, mouse.button を取った場合のキーアサイン。

  • L, R, SELECT, START, X, Y が MouseEvent.button = 1 になってしまうため判別できない
  • Up, Down, Left, Right, A, B は判別可能。Bボタンを取るためには、コンテキストメニューを禁止する必要がある
+---+-----------------------------------+---+
+ m1  +--+                         +--+  m1 +
|     |Up|                         |m1|     |
|  +--+  +--+                   +--+  +--+  |
@uupaa
uupaa / ES6 and ES7 new keywords.md
Last active October 23, 2018 12:02
ES6 and ES7 new keywords
@uupaa
uupaa / a.md
Last active August 29, 2015 14:18

BasicDataTypes

Coordinates and Twips (座標系とtwips)

  • SWFにおける x と y は整数型
    • ブラウザと同じスクリーン座標系
      • x は水平軸, 0 が左端
      • y は垂直軸, 0 が上端
  • twips という単位がある。1px === 20 twips
  • { width: 800 twip, height: 400 twip } の矩形は { width: 40px height: 20px } として表示
(function(global) {
"use strict";
// --- dependency modules ----------------------------------
var Hash = global["Hash"];
// --- define / local variables ----------------------------
//var _isNodeOrNodeWebKit = !!global.global;
//var _runOnNodeWebKit = _isNodeOrNodeWebKit && /native/.test(setTimeout);
//var _runOnNode = _isNodeOrNodeWebKit && !/native/.test(setTimeout);
@uupaa
uupaa / Aaa1.js
Last active August 29, 2015 14:17
Object.create と prototype を適切に使わない Class 定義が如何に遅いか
// function declaration
(function(global) {
"use strict";
function Aaa1(value) {
this._value = value || "";
}
Aaa1.prototype = Object.create(Aaa1, {
constructor: { value: Aaa1 },
@uupaa
uupaa / Object.freeze.md
Last active August 29, 2015 14:17
Object.freeze, Object.isFrozen, WeakMap, localStorage

in Chrome

var a = { a: 1 };

var map = new WeakMap();

Object.freeze(map);
Object.isFrozen(map); // -> true
map.set(a, "123");
@uupaa
uupaa / requestAnimationFrame and Date.now in WebKit.md
Last active August 29, 2015 14:16
requestAnimationFrame and Date.now in WebKit
@uupaa
uupaa / gist:c988bfd05a3e02152142
Created February 26, 2015 19:49
Spec.js Storage.js
//{@spec_storage
(function(global) {
"use strict";
// --- dependency modules ----------------------------------
// --- define / local variables ----------------------------
//var _isNodeOrNodeWebKit = !!global.global;
//var _runOnNodeWebKit = _isNodeOrNodeWebKit && /native/.test(setTimeout);
//var _runOnNode = _isNodeOrNodeWebKit && !/native/.test(setTimeout);
//var _runOnWorker = !_isNodeOrNodeWebKit && "WorkerLocation" in global;