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'; | |
| // Use path PATH=bin\;F:\Python27\;F:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;F:\bin | |
| // Run with node stdio.js < A-small.in | |
| const assert = require('assert'); | |
| const fs = require('fs'); | |
| function err() { | |
| process.stderr.write(Array.prototype.join.call(arguments, ' ') + '\n'); | |
| } |
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> | |
| <!-- Modified version of pointer lock code to lock on click from the main loop, works on Safari --> | |
| <html lang="en"><head> | |
| <title>Pointer Lock Test</title> | |
| </head> | |
| <body onload="startup()"> | |
| <div id="status-element" style="background-color: #FEE; white-space: pre-wrap;">dragx=0, dragy=0 | |
| double clicks: 0</div> | |
| <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
| /* eslint no-bitwise:off */ | |
| /* Results: | |
| Plain DataView / Native mapped Buffers | |
| Node 0.4.12 / 5276ms (not quite the same test) | |
| Node 0.6.21 8275ms / 1070ms (12%) (not quite the same test) | |
| Node 0.8.28 6739ms / 986ms (14%) (not quite the same test) | |
| Node v4.8.2: 4500ms / 1939ms (43%) | |
| Node v6.9.1: 3900ms / 1090ms (28%) | |
| Node v8.11.3: 2111ms / 2928ms (138%) | |
| Node v10.16.0: 2200ms / 260ms (12%) |
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
| const { random, floor } = Math; | |
| function tryit() { | |
| let count = 0; | |
| while (true) { | |
| ++count; | |
| if (random() < 1 / (2000 - count)) { | |
| return count; | |
| } | |
| } | |
| } |
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
| const { round, floor, ceil } = Math; | |
| let correct = [0,0,0]; | |
| function test(dpr, dim) { | |
| let clientWidth = round(dim / dpr); | |
| let scaled = clientWidth * dpr; | |
| if (round(scaled) === dim) { | |
| correct[0]++; | |
| } | |
| if (floor(scaled) === dim) { | |
| correct[1]++; |
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"; | |
| var _window$foo = window.foo, | |
| a = _window$foo[0], | |
| b = _window$foo[1]; | |
| //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluLmpzIl0sIm5hbWVzIjpbIndpbmRvdyIsImZvbyIsImEiLCJiIl0sIm1hcHBpbmdzIjoiOztrQkFBYUEsTUFBTSxDQUFDQyxHO0lBQWZDLEM7SUFBR0MsQyIsImZpbGUiOiJpbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImxldCBbYSwgYl0gPSB3aW5kb3cuZm9vO1xuIl19 |
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
| dofile("common.inc"); | |
| dofile("screen_reader_common.inc"); | |
| dofile("ui_utils.inc"); | |
| local styles = { | |
| WS_BORDER=0x00800000, | |
| WS_DLGFRAME=0x00400000, | |
| -- WS_CAPTION=0x00C00000, WS_BORDER | WS_DLGFRAME | |
| -- WS_CHILD=0x40000000, not relevant |
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
| // Path to directory, or file, but not to a "." (e.g. c:/foo/.) | |
| void exploreTo(const char *localfname) { | |
| wchar_t *path = utf8ToWideAlloc(localfname); | |
| for (wchar_t *s = path; *s; ++s) | |
| if (*s == '/') | |
| *s = '\\'; | |
| // Remove trailing backslash, FindFirst will fail | |
| if (path[wcslen(path) - 1] == '\\') { | |
| path[wcslen(path) - 1] = '\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
| /** | |
| * Conceptual/Code-time hierarchy: | |
| * | |
| * Sever Code Common Code Client Code | |
| * | |
| * | |
| * EntityGameServer EntityGameClient | |
| * Game Code | \ / | | |
| * | EntityGameCommon | | |
| * | | | |
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
| // The setup: I have an Entity class hierarchy for server/common/client, and each entity has | |
| // a reference to an entity_manager, which should be templated to the appropriate type so | |
| // that an entity getting other entities from the manager always get the correct type of | |
| // entity back. | |
| // The common code: | |
| interface EntityManager<Entity extends EntityCommon = EntityCommon> { | |
| entities: Partial<Record<number, Entity>>; | |
| } |