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
let radius = 100.0; | |
let cb = Math.cbrt(Math.random()); // 一様乱数の立方根 | |
let yc = Math.random() * 2.0 - 1.0; // Y 方向のコサイン相当を単に乱数から得る | |
let yr = Math.sqrt(1.0 - yc * yc); // 逆数 | |
let th = Math.random() * Math.PI * 2.0; // XZ 平面に対するシータ | |
let point = [ | |
radius * cb * yr * Math.cos(th), | |
radius * cb * yc, | |
radius * cb * yr * Math.sin(th) | |
]; |
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
(async () => { | |
let v = 0; | |
for(let i = 0; i < 10; ++i){ | |
x = await ((index) => { | |
setTimeout(() => { | |
console.log('🔥'.repeat(index + 1)); | |
}, index * 500); | |
return index * index; | |
})(i); | |
console.log(x); |
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 Emitter { | |
static get EVENTS(){return [ | |
'renderingComplete', | |
'focusComplete' | |
];} | |
constructor(){ | |
this.listeners = {}; | |
} | |
emit(eventName, arg){ | |
if(this.listeners.hasOwnProperty(eventName) === true){ |
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 checkExistsFile(a, b){ | |
// 空白等が指定されていないか | |
if(a == null || a === '' || b == null || b === ''){return false;} | |
let arrA = Array.from(a); | |
let arrB = Array.from(b); | |
// サロゲートペアを考慮した上での文字数が一致しているか | |
if(arrA.length === 0 || arrA.length !== arrB.length || arrB.length === 0){return false;} | |
// ループで位置文字ずつ一致状況を調べる | |
let flag = true; | |
for(let i = 0; i < arrA.length; ++i){ |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>noisy</title> | |
<script src="https://wgld.org/j/noiseX.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
let octave = 6; | |
let offset = 4; | |
let persistence = 0.5; | |
let baseWidth = Math.pow(2, octave + offset); |
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
/** | |
* Windows のプロセス ID を受け取り対象プロセスのウィンドウを前面に出す | |
* @param {number} pid - process id | |
*/ | |
function setForegroundWindowFromProcess(pid){ | |
let className = 'hoge' + Date.now(); | |
let source = ` | |
Add-Type @" | |
using System; |
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 InteractionCamera | |
* @example | |
* let camera = new InteractionCamera(); | |
* window.addEventListener('mousedown', camera.startEvent, false); | |
* window.addEventListener('mousemove', camera.moveEvent, false); | |
* window.addEventListener('mouseup', camera.endEvent, false); | |
* camera.update(); | |
* mMatrix = gl3.Math.Qtn.toMat4(camera.qtn, mMatrix); | |
*/ |
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 DrawCanvas { | |
constructor(size){ | |
this.canvas = document.createElement('canvas'); | |
this.canvas.width = this.canvas.height = size; | |
this.ctx = this.canvas.getContext('2d'); | |
} | |
drawGradationShadow(colorRGB){ | |
let center = [this.canvas.width / 2, this.canvas.height / 2]; | |
let radius = Math.min(center[0], center[1]) * 0.9; | |
let colorFill = 'rgba(' + colorRGB.join(',') + ', 0.0)'; |
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
git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -1 | awk -F'[]~^[]' '{print $2}' |
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
$ git fetch origin pull/ID/head:BRANCHNAME |