Skip to content

Instantly share code, notes, and snippets.

View dherman's full-sized avatar

Dave Herman dherman

View GitHub Profile
@dherman
dherman / cargo-topics.md
Created September 14, 2017 17:06
cargo extensibility discussion topics

Neon

Goal: eliminate the necessity for neon-cli to wrap cargo so Neon projects can directly use all cargo commands in the Rust source directory.

Ideas:

  1. Specify link flags in manifest
  • On macOS need to pass -C link-args=-Wl,-undefined,dynamic_lookup
  • Want users to be able to just type cargo build
@dherman
dherman / abstract-classes.rs
Created August 28, 2017 23:21
example of an abstract class pattern failing to work with pub(crate)
pub(crate) trait EmployeePrivate {
fn unique_key(&self) -> i32;
}
pub struct Engineer {
key: i32,
name: String
}
pub struct EngineeringManager {
var addon = require('../native');
var array1 = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]);
var array2 = new Uint8Array(addon.munge(array1.buffer));
console.log(array1);
console.log(array2);
@dherman
dherman / oss-bibliography.md
Last active May 26, 2017 02:34
A little OSS bibliography

A Little OSS bibliography

type NumberDict = {[key: string]: number};
type NullableObject = {} | null;
function nullableObjectIsNumberDict(x: NullableObject): x is NumberDict {
return !!x && Object.keys(x).every(key => typeof x[key] === 'number');
}
function use(x: NullableObject) {
if (!nullableObjectIsNumberDict(x)) {
return;
20:54 dherman 1. I imagine an object can only be a global object for one realm, right?
20:54 shu oh my word yes
20:54 dherman lol
20:54 dherman don't panic
20:54 dherman I'm just collecting invariants
20:54 dherman (this is for the Realm API)
20:54 dherman 2. if you had a pre-existing object,
20:54 dherman that isn't a global object
20:55 dherman would it be problematic to allow using that object as a global object for a new realm?
20:55 shu yes, the thing that's actually branded GlobalObjects internally can't be just any plain object
Dave Herman@DESKTOP-DT0E73J MINGW64 ~/Sources/snarfblatt
$ npm install
> snarfblatt@0.1.0 install C:\Users\Dave Herman\Sources\snarfblatt
> neon build
neon info running cargo
neon info cargo build --release --target=x86_64-pc-windows-msvc
Compiling neon-runtime v0.1.11 (file:///C:/Users/Dave%20Herman/Sources/neon/crates/neon-runtime)
Compiling neon v0.1.11 (file:///C:/Users/Dave%20Herman/Sources/neon)
@dherman
dherman / a.js
Last active February 7, 2017 16:06
a tiny userland loader, using a "parse" and "link" primitive
import {b} from "./b.js";
import $ from "jquery";
export function a() {
// ...
}
@dherman
dherman / a.js
Last active February 3, 2017 17:44
a tiny userland registry, using a "parse" and "link" primitive
import {b} from "./b.js";
import $ from "jquery";
export function a() {
// ...
}
@dherman
dherman / module-cors-policy.md
Last active January 31, 2017 16:49
proposed cors policy for modules

Proposed CORS Policy for Modules

Module MIME types are strict

If a module script receives a non-JS MIME type, it doesn't execute.

Modules are anonymous

Module scripts default to the anonymous CORS attribute.