Skip to content

Instantly share code, notes, and snippets.

View jfparadis's full-sized avatar

Jean-Francois Paradis jfparadis

View GitHub Profile
@jfparadis
jfparadis / realms-api.md
Created August 25, 2016 04:33 — forked from dherman/realms-api.md
ES6 Realms API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Realms

Updated (Aug 2nd, 2016)

API Refinements:

  • The default global scope when creating a new realm has no extra capabilities, it is confusing, we can remove it.
  • The realm object is the real power object, and users can decide to share it or not via endowments.
  • In a realm, you can create as many global scopes as you want via realmObj.createNewGlobalScope().
  • No more proxy-like API at the realm level, if you want to proxy a global, that should be used when creating a new global scope.

The API proposal:

@jfparadis
jfparadis / disable.sh
Created September 21, 2017 02:20
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@jfparadis
jfparadis / keybase.md
Created October 3, 2019 14:09
Keybase proof

Keybase proof

I hereby claim:

  • I am jfparadis on github.
  • I am jfparadis (https://keybase.io/jfparadis) on keybase.
  • I have a public key ASB5XxeA-KDrLKr4CvESPvXtBQIfFKHk5zGlNPuE4HF8pwo

To claim this, I am signing this object:

@jfparadis
jfparadis / README.md
Last active January 10, 2020 06:19
XS module map vs namespace

XS module map vs namespace

Results

  1. Module map can only be populated from Compartment map
  2. Any attempt to use the namespaces fails

Type check

typeof Compartment.map.mod
// symbol
@jfparadis
jfparadis / README.md
Last active January 10, 2020 08:02 — forked from dckc/main.js
Compartment global acessor before imports, & multiple imports() calls per compartment

Compartment dynamic import & multiple imports per compartment

Output

mod1
getting g1: g1 original value
g1 original value
setting g1: g1 original value -> new value 1
mod1 done.
mod2
@jfparadis
jfparadis / app.js
Created January 10, 2020 21:00 — forked from phoddie/app.js
Lightbulb example using Secure ECMAScript from talk given at Agoric meetup December 5, 2019 after TC39 San Francisco
/*
* Copyright (c) 2019 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK.
*
* This work is licensed under the
* Creative Commons Attribution 4.0 International License.
* To view a copy of this license, visit
* <http://creativecommons.org/licenses/by/4.0>.
* or send a letter to Creative Commons, PO Box 1866,
@jfparadis
jfparadis / README.md
Last active January 22, 2020 20:04
SESCompartment

A Compartment object abstracts the notion of a distinct global environment, with its own global object, copy of the standard library, but shares the "intrinsics" (standard objects that are not bound to global variables, like the initial value of Object.prototype) with the current execution environment.

Compartment Constructor

class Compartment {
  constructor: (
    globals : object?,                  // extra globals added to the global object
    modules: object?,                   // module map, specifier to specifier
  ) -> object,
@jfparadis
jfparadis / Compartment.js
Last active January 24, 2020 00:03
XS Compartment shim
trace(`Compartment imported\n`);
const XSCompartment = globalThis.Compartment;
trace('Compartment.map: ' + Object.keys(XSCompartment.map)+'\n');
// Mappin utility function.
// Create the child XS map from the parent XS map.
function createXSMap(modules) {
// Need to at least allow new compartments to be created.
const result = { Compartment: XSCompartment.map.Compartment };
@jfparadis
jfparadis / README.md
Last active January 24, 2020 03:01
A compartment module resolver function for XS

A compartment module resolver function for XS

This gist shows that the compartment module map doesn't have to be deterministic.

On each subsequent run, the module map resolves to different modules depending on the current seconds on the clock.

Output

Example of executing the same code without recompile before the second run: