Skip to content

Instantly share code, notes, and snippets.

View TimothyGu's full-sized avatar
🤠
🤠

Timothy Gu TimothyGu

🤠
🤠
  • Seattle, US
  • 02:51 (UTC -07:00)
View GitHub Profile
"g"
>>> {"id":16,"method":"Runtime.evaluate","params":{"expression":"this","objectGroup":"completion","includeCommandLineAPI":true,"silent":true,"contextId":1,"returnByValue":false,"generatePreview":false,"userGesture":false,"awaitPromise":false,"throwOnSideEffect":false}}
<<< {"id":16,"result":{"result":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":9}"}}}
>>> {"id":17,"method":"Runtime.evaluate","params":{"expression":"g","includeCommandLineAPI":true,"contextId":1,"generatePreview":true,"userGesture":true,"awaitPromise":false,"throwOnSideEffect":true,"timeout":500}}
<<< {"id":17,"result":{"result":{"type":"object","subtype":"error","className":"ReferenceError","description":"ReferenceError: g is not defined\n at <anonymous>:1:1","objectId":"{\"injectedScriptId\":1,\"id\":10}"},"exceptionDetails":{"exceptionId":4,"text":"Uncaught","lineNumber":0,"columnNumber":0,"scriptId":"88","stackTrace":{"callFrames":[{"functionName":"","scriptId":"88","url":"
diff --git a/lib/internal/vm/Module.js b/lib/internal/vm/Module.js
index c7f90a83a3..806c7ae20f 100644
--- a/lib/internal/vm/Module.js
+++ b/lib/internal/vm/Module.js
@@ -32,6 +32,7 @@ const perContextModuleId = new WeakMap();
const wrapMap = new WeakMap();
const dependencyCacheMap = new WeakMap();
const linkingStatusMap = new WeakMap();
+const linkingStatusDeferredMap = new WeakMap();
'use strict';
const { Module } = require('vm');
process.on('unhandledRejection', p => {
process.nextTick(() => { throw p; });
});
(async () => {
const rootModule = new Module('export default 5;');
'use strict';
const { Module } = require('vm');
process.on('unhandledRejection', p => {
process.nextTick(() => { throw p; });
});
(async () => {
const rootModule = new Module('export default 5;');
"use strict";
// Example integration of the new vm.Module API into jsdom.
const vm = require("vm");
const { URL } = require("url");
class ModuleScript {
constructor() {
this.context = null;
@TimothyGu
TimothyGu / gist:8f930b931a51999b6100cb42b1156153
Created October 8, 2017 22:17
Array with a negative length!
'use strict';
const OriginalArray = global.Array;
global.Array = function Array(...args) {
const arr = new OriginalArray(...args);
let length = arr.length;
return new Proxy(arr, {
set(target, propKey, value, Receiver) {
if (propKey === 'length') {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>64bit comparison</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>

The Holy Scripture

By Albert Lee.

Draft 4/27/2015.

First Letter to the Santa Margaritans

#!/bin/sh
set -e
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
cd ~/.vim/bundle
git clone --depth=1 https://github.com/tpope/vim-sensible.git &
git clone --depth=1 https://github.com/tomtom/tcomment_vim.git &
git clone --depth=1 https://github.com/Raimondi/delimitMate.git &
extend layout.jade
block content
p Content