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
/** | |
* Vector Class | |
* | |
*/ | |
function Vector(x, y, angle, length) { | |
if (typeof x === "number" && typeof y === "number") { | |
this._x = x; | |
this._y = y; |
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
➜ 3DPrimitivesExample EMCC_DEBUG=1 emmake make -s VERBOSE=1 | |
DEBUG:root:PYTHON not defined in /Users/enaml/.emscripten, using "/usr/local/opt/python/bin/python2.7" | |
DEBUG:root:JAVA not defined in /Users/enaml/.emscripten, using "java" | |
DEBUG:root:Cache: PID 12909 acquiring multiprocess file lock to Emscripten cache | |
DEBUG:root:Cache: done | |
DEBUG:root:Cache: PID 12909 released multiprocess file lock to Emscripten cache | |
DEBUG:root:check tells us to use asm.js backend | |
HOST_OS=Darwin | |
Compiling OF library for Release | |
HOST_OS=Darwin |
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
➜ 3DPrimitivesExample emrun --browser chrome bin/3DPrimitivesExample.html | |
Executing /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito --enable-nacl --enable-pnacl --disable-restore-session-state --enable-webgl --no-default-browser-check --no-first-run --allow-file-access-from-files http://localhost:6931/3DPrimitivesExample.html | |
[14682:36355:0719/031111.215804:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process. | |
-1 | |
missing function: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc | |
-1 | |
warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling | |
exception thrown: abort(-1) at Error | |
at jsStackTrace (http://localhost:6931/3DPrimitivesExample.js:1:23490) | |
at stackTrace (http://localhost:6931/3DPrimitivesExample.js:1:23661) |
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
➜ 3DPrimitivesExample EMCC_DEBUG=1 emmake make -s DEMANGLE_SUPPORT=1 ASSERTIONS=1 | |
DEBUG:root:PYTHON not defined in /Users/enaml/.emscripten, using "/usr/local/opt/python/bin/python2.7" | |
DEBUG:root:JAVA not defined in /Users/enaml/.emscripten, using "java" | |
DEBUG:root:Cache: PID 16629 acquiring multiprocess file lock to Emscripten cache | |
DEBUG:root:Cache: done | |
DEBUG:root:Cache: PID 16629 released multiprocess file lock to Emscripten cache | |
DEBUG:root:check tells us to use asm.js backend | |
HOST_OS=Darwin | |
Compiling OF library for Release | |
HOST_OS=Darwin |
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
/* | |
Computes the next power-of-two integer greater than or equal to `num` via binary searching the bits | |
*/ | |
const nextPOT = (num) => { | |
num = num | 0; | |
if (num === 0) { | |
return 0; | |
} | |
let min = 0; | |
let max = 64; // assume numbers in JS are no larger than 64 bits |
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
public class QuickSelect { | |
// STATIC VARS | |
static Random rand = new Random(); | |
/* | |
Tests | |
----- | |
*/ | |
public static void main(String[] args) { |
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
// run | |
const ctx = initCtx(); | |
const text = `hello my friends`; | |
draw({ size: 16, fontFace: `monospace` }, text, 10, 50); | |
// initialize canvas context | |
function initCtx(w = 600, h = 400) { | |
// create canvas & ctx | |
const canvas = document.createElement('canvas'); | |
document.body.appendChild(canvas); |
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
/** | |
* Game of Life in Reason.ml | |
* ========================= | |
*/ | |
/** | |
* Coord | |
*/ | |
module Coord = { | |
/* Type defs: */ |
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 { log } = console; | |
const SPACE = " "; | |
const isString = (val) => typeof val === 'string' || val instanceof String; | |
/** | |
* Justify Text | |
* ============ | |
* TODO: description | |
*/ |
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
/* | |
ocaml src: https://bucklescript.github.io/bucklescript/api/Belt.html | |
*/ | |
/* base type */ | |
type intTuple = (int, int); | |
/* hashable tuple */ | |
module TupleHashable = Belt.Id.MakeHashable({ |
OlderNewer