Skip to content

Instantly share code, notes, and snippets.

View chicoxyzzy's full-sized avatar

Sergey Rubanov chicoxyzzy

View GitHub Profile
@chicoxyzzy
chicoxyzzy / install.md
Last active September 1, 2015 09:05 — forked from svnlto/install.md
@chicoxyzzy
chicoxyzzy / noncoercible.js
Last active March 15, 2021 17:09
Non-coercible objects
function nonCoercible(val) {
if (val == null) {
throw TypeError('nonCoercible shouldn\'t be called with null or undefined');
}
const res = Object(val);
res[Symbol.toPrimitive] = () => {
throw TypeError('Trying to coerce non-coercible object');
}
return res;
};
@chicoxyzzy
chicoxyzzy / hello.asm.js
Last active January 3, 2017 23:53
Rust -> wasm
Module["asm"] = (function(global, env, buffer) {
'almost asm';
var HEAP8 = new global.Int8Array(buffer);
var HEAP16 = new global.Int16Array(buffer);
var HEAP32 = new global.Int32Array(buffer);
var HEAPU8 = new global.Uint8Array(buffer);
var HEAPU16 = new global.Uint16Array(buffer);
var HEAPU32 = new global.Uint32Array(buffer);
@chicoxyzzy
chicoxyzzy / hello.js
Created January 3, 2017 23:54
Rust -> wasm
/*
* Copyright 2015 WebAssembly Community Group participants
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@chicoxyzzy
chicoxyzzy / hello.rs
Created January 3, 2017 23:54
Rust -> wasm
fn main() {
println!("Hello, Emscripten!");
}
@chicoxyzzy
chicoxyzzy / hello.wast
Created January 3, 2017 23:55
Rust -> wasm
This file has been truncated, but you can view the full file.
(module
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ji (func (param i32) (result i64)))
(type $FUNCSIG$viii (func (param i32 i32 i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$i (func (result i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
@chicoxyzzy
chicoxyzzy / results
Created January 19, 2017 01:21
Benchmarking for loops
Now using node v4.7.2 (npm v2.15.11)
// v8 4.5.103.43 (Node.js 4.7.2)
forVar_______: 2ms
forLet_______: 13ms
forOfVar_____: 66ms
forOfLetConst: 64ms
forEachVar___: 15ms
forEachLet___: 21ms
@chicoxyzzy
chicoxyzzy / nvm-node-nightlies.md
Last active February 6, 2024 16:44
Installing Node Nightlies via nvm

You can install Node Nightlies/RCs via nvm using NVM_NODEJS_ORG_MIRROR environment variable.

Install latest Node RC

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/rc/ nvm i node

Install latest Node.js Nightly

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm i node