This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Obj View</title> | |
| <!-- JavaScript --> | |
| <script src="js/gl-matrix.js"></script> | |
| <script> | |
| (() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createShader(gl, id) { | |
| const element = document.getElementById(id); | |
| const [type, text] = [element.type, element.text]; | |
| let shader; | |
| switch(type) { | |
| case "x-shader/x-vertex": | |
| shader = gl.createShader(gl.VERTEX_SHADER); | |
| break; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // プリミティブ値 | |
| // undefined | |
| hoge === undefined; // strict mode のみ | |
| hoge === void 0; | |
| typeof hoge === "undefined"; | |
| Object.prototype.toString.call(hoge) === "[object Undefined]"; // 他に Symbol.toStringTag が "Undefined" なオブジェクトがないときのみ | |
| // null | |
| hoge === null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyEventTarget extends DocumentFragment { | |
| constructor() { | |
| super(); | |
| Object.setPrototypeOf(this, EventTarget.prototype); | |
| } | |
| static [Symbol.hasInstance](instance) { | |
| return instance instanceof EventTarget; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| function sleepSort(array, callback) { | |
| array = array || []; | |
| callback = callback || noop; | |
| const promises = [], ret = []; | |
| let retPromise; | |
| for(let val of array) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for(let TypedArray of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) { | |
| Object.defineProperty(TypedArray.prototype, "slicedBuffer", { | |
| get: function() { | |
| let byteOffset = this.byteOffset, byteLength = this.byteLength; | |
| return this.buffer.slice(byteOffset, byteOffset + byteLength); | |
| } | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class InlineWorker extends Worker { | |
| constructor(func) { | |
| if(typeof func !== "function") | |
| throw new TypeError("Please set function"); | |
| let str = `(${func.toString()})()`; | |
| //let str = func.toString().match(/\s*{([\w\W]*?)}$/)[1]; | |
| let blob = new Blob([str], {type:"text/javascript"}); | |
| super(URL.createObjectURL(blob)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * ArrayBuffer から文字列にデコードする | |
| * @param {ArrayBuffer} buffer | |
| * @param {string} charset | |
| * @returns {Promise<string>} | |
| */ | |
| async function decodeText(buffer, charset="utf-8") { | |
| // Encoding API | |
| if (window.TextDecoder) { | |
| const decoder = new TextDecoder(charset); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var phantom = require('node-phantom-async'); | |
| var co = require('co'); | |
| var buildQuery = function (object) { | |
| return Object.keys(object).map(function (key) { | |
| return encodeURIComponent(key) + '=' + encodeURIComponent(object[key]); | |
| }).join('&'); | |
| } | |
| var scrapeFromCiNii = function (keywords) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://qiita.com/mpyw/items/b7192d3aadf90d55ad49 | |
| (function (root) { | |
| "use strict"; | |
| // 単純に constructor を外に出してみた。こっちの方が好み。 | |
| function Retmise(options) { | |
| if (this.constructor !== Retmise) { | |
| return new Retmise(options); | |
| } |
NewerOlder