This file contains 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
type Keys<T extends readonly string[]> = Readonly<{ [key in T[number]]: key }>; | |
// const keys = ["feat1", "feat2"] as const; | |
export const makeEnumLikeFromArray = <T extends readonly string[]>(array: T) => | |
Object.fromEntries(array.map((item) => [item, item])) as Keys<T>; | |
// const a = make<typeof keys>(keys); |
This file contains 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
<main> | |
<controls> | |
<div class="new-game">New Game</div> | |
<div>Moves <span class="moves">0</span> / <span class="max-moves">30</span></div> | |
</controls> | |
<board></board> | |
<colors></colors> | |
<controls> | |
<div>Skill <span class="skill">0</span></div> | |
<div><input type="range" class="level" value="10" min="3" max="10" /></div> |
This file contains 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
<div id="keysleft"> | |
move: WASD | |
<br>hold/drop: E | |
<br>pause: F | |
<br>gravity: R | |
</div> | |
<div id="keysright"> | |
zoom: + - | |
<br>fire: click | |
<br>testing: T |
This file contains 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
<svg height = '800' width = '1200'> | |
<g id="grid" stroke="#f2f2f2"> | |
<line x1="0" y1="0" x2="3000" y2="0" style="stroke-dasharray:1,58,1,0;stroke-width:3000;"/> | |
<line x1="0" y1="0" x2="0" y2="3000" style="stroke-dasharray:1,58,1,0;stroke-width:3000;"/> | |
</g> | |
</svg> | |
<br> | |
Controls: arrow keys |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains 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
import Mocha from "mocha" | |
export default new Mocha() |
This file contains 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 context = {}; | |
context.createContext = function (fn) { | |
let name = "context" + Math.floor(Math.random() * 10000000); | |
Object.defineProperty(fn, "name", {value: name}); | |
let params = {}; | |
global[name] = params; | |
fn(params); | |
delete global[name]; | |
}; |
This file contains 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
const makeG = n => x => (x ** 2 + 1) % n; | |
const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b)); | |
const pollard = n => { | |
const g = makeG(n); | |
let x = 1; | |
let y = 2; |
NewerOlder