Skip to content

Instantly share code, notes, and snippets.

View test.ts
// The entry file of your WebAssembly module.
class OnlyHasUnchecked {
length: i32 = 3;
@operator("{}")
protected __get(index: i32): i32 {
return index;
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am jtenner on github.

  • I am devilmint (https://keybase.io/devilmint) on keybase.

  • I have a public key ASAd8zM4Uwfwh1TpXx0o5g-db62_yJOXSjstwI5i_Cw6Ywo

View output.wat
(module
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viii (func (param i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vdii (func (param f64 i32 i32)))
View SetTransformOperation.spec.ts
import { SetTransformOperation } from "../internal/operations/SetTransformOperation";
import { CanvasContext2DInstructionType } from "../../src/shared/CanvasContext2DInstructionType";
describe("SetTransformOperation", () => {
it("should write to a buffer", () => {
// Create an array buffer with the size of a SetTransformOperation
let buffer = new ArrayBuffer(offsetof<SetTransformOperation>());
// write to the buffer at index 0
let nextIndex = SetTransformOperation.write(buffer, 0, 1, 2, 3, 4, 5, 6);
View changetype.ts
class Vec3 {
x: f64;
y: f64;
z: f64;
}
const refPointer: usize = __alloc(5000);
const a = new Vec3();
const b = changetype<Vec3>(refPointer);
View gist:6c7f7f2fef758f697f363990dc6cb5bc
describe("A failing test", (): void => {
it("should fail", (): void => {
expect<bool>(false).toBeTruthy("Show this message, because we expect a falsy value to be truthy!");
});
});
View toStrictEqual.spec.ts
class Vec3 {
constructor(
public x: f64,
public y: f64,
public z: f64,
) {}
}
let a = new Vec3(1.0, 2.0, 3.0);
View not.spec.ts
describe("not", (): void => {
it("should not be -1", (): void => {
expect<i32>(42).not.toBe(-1, "42 is not -1");
});
});
View toBe.spec.ts
class Vec3 {
x: f64 = 0;
y: f64 = 0;
z: f64 = 0;
}
describe("Vec3", (): void => {
it("should add up", (): void => {
expect<i32>(19 + 23).toBe(42);
});
View log.spec.ts
class Bar {}
describe("Foo", (): void => {
log<string>("Some string value");
log<i32>(42); // all number types are supported
log<Bar>(new Bar()); // displays the raw bytes in the console
log<Bar>(null); // null reference
});