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
Show hidden characters
{ | |
"presets": [ | |
["env", { | |
"targets": { | |
"browsers": ["chrome 85"] | |
} | |
}] | |
] | |
} |
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
[package] | |
name = "multiplayer" | |
version = "0.0.1" | |
publish = false | |
[dependencies] | |
futures = "0.1.18" | |
hyper = "0.11.17" | |
tokio-core = "0.1.12" | |
tokio-signal = "0.1.4" |
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
fn main() { | |
// Ok(0.000000000...0000000005) | |
println!("{:?}", "4.9406564584124654e-324".parse::<f64>()); | |
// WTF??? | |
// Err(ParseFloatError { kind: Invalid }) | |
println!("{:?}", "4.94065645841246545e-324".parse::<f64>()); | |
// Ok(0.000000000...0000000005) | |
println!("{:?}", "4.9406564584124655e-324".parse::<f64>()); |
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
// This code demonstrates a simplified "stackification" algorithm to turn | |
// instructions in a basic block back into a tree. This is useful when | |
// generating WebAssembly code from assembly instructions in SSA form. | |
// | |
// It's the algorithm used by LLVM's WebAssembly backend, viewable here: | |
// https://github.com/llvm-mirror/llvm/blob/master/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | |
type InsKind = | |
'Add' | | |
'LocalSet' | |
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
#include "FGNode.h" | |
#include <stdio.h> | |
bool Node::supportsFillPaintData() const { | |
return usesGeometryCache(_fields._type); | |
} | |
const PaintData& Node::fillPaintData() const { | |
const auto* value = _fields._fillPaintData.get(); | |
if (!supportsFillPaintData() || !value) { |
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
/* | |
This demonstrates a problem I ran into when writing a parser in Rust. It | |
appears that adding more branches to a match expression causes the function | |
to consume more stack space. The stack space used in this example isn't too | |
extreme but in my actual parser, each function call uses around 15kb of stack | |
space which adds up very quickly. It only takes around 30 nested calls to | |
use 512kb of stack space, after which a stack overflow crash occurs. | |
Here's the output of this program on https://play.rust-lang.org/: |
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
[submodule "skew"] | |
path = skew | |
url = [email protected]:evanw/skew.git | |
[submodule "typescript"] | |
path = typescript | |
url = https://git01.codeplex.com/typescript | |
[submodule "coffeescript"] | |
path = coffeescript | |
url = [email protected]:jashkenas/coffeescript.git |
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
class Assert { | |
public static inline function assert(truth: Bool) { | |
if (!truth) { | |
trace('assert failed'); | |
} | |
} | |
} | |
// This demonstrates using type wrapping to make an efficient color API. Colors | |
// are stored directly as 32-bit integers and don't cause any allocations. |
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
default: native web | |
native: a.out | |
./a.out | |
web: a.out.js | |
node a.out.js | |
a.out: test_generated.h | |
c++ -std=c++11 test.cpp |
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
# This is a simple wrapper for the "emcc" command from the emscripten compiler. | |
# Unlike the emscripten SDK script, it lets you specify the compiler version | |
# number. Just pass the version number using the "--version" flag and put the | |
# flags for "emcc" after the "--": | |
# | |
# python emcc_wrapper.py --version 1.27.0 -- -O3 -s NO_EXIT_RUNTIME=1 ... | |
# | |
import os | |
import sys | |
import pipes |
NewerOlder