Skip to content

Instantly share code, notes, and snippets.

View lll000111's full-sized avatar
🏠
Working from home

KittenWithHerbs lll000111

🏠
Working from home
View GitHub Profile
@lll000111
lll000111 / AsyncStackTraces
Last active July 6, 2019 20:55
function version 1 creates a full async stack trace, version 2 does not
// ====================================================================
// CODE FOR issue https://bugs.chromium.org/p/v8/issues/detail?id=9443
// ====================================================================
const fs = require('fs');
const readFile = fs.promises.readFile;
/*
#### RESULTS ####
@lll000111
lll000111 / asyncStackTraceExampleCode
Last active July 5, 2019 11:12
V8 Zero-cost stack trace test/issue/question demo code
/* node.js v12.6.0, TypeScript - i.e. ES2018 + type annotations */
/*
===============================================
OLD VERSION (using fs.readFile)
===============================================
With this function I did NOT get a full async stacktrace. Example:
FileNotFoundError: File not found: c3ba0f23b58a5c645b7f3e803b1ba5af42d8d2f9262b029d2718a89709ba0b03 [objects]
@lll000111
lll000111 / eslintrc.js
Created April 30, 2019 12:41
TypeScript project eslintrc
module.exports = {
'root': true,
// eslint recommended defaults can be found in [INSTALL_DIR]/eslint/conf/eslint.json
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaFeatures': {},
@lll000111
lll000111 / output.txt
Created February 26, 2019 11:17
Flow console
This file has been truncated, but you can view the full file.
rt":{"line":27,"character":47},"end":{"line":27,"character":56}}},"message":"[2] `WebSocket`"}]}]}}
Content-Length: 378
{"jsonrpc":"2.0","method":"telemetry/event","params":{"type":1,"message":"Server fatal exception: [] End_of_file\nRaised at file \"map.ml\", line 130, characters 10-25\nCalled from file \"hack/utils/collections/myMap.ml\", line 15, characters 13-23\n---\nRaised at file \"string.ml\", line 118, characters 19-34\nCalled from file \"sexp.ml\", line 112, characters 13-47\n"}}
Content-Length: 159
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/mha/one.core/src/system-moddable/websocket.js","diagnostics":[]}}
@lll000111
lll000111 / build.js
Created January 29, 2019 11:16
build.js for Neo one
#!/usr/bin/env node
// @flow
'use strict';
/* eslint-disable arrow-parens, no-console, no-await-in-loop */
const {basename, dirname, join, relative} = require('path');
const {promisify} = require('util');
const crypto = require('crypto');
const exec = promisify(require('child_process').exec);
@lll000111
lll000111 / index.html
Last active October 10, 2018 09:37 — forked from Jeff-Mott-OR/index.html
Untitled benchmark #jsbench #jsperf (http://jsbench.github.io/#ef5533b8dfb56af8a289792f21760bcc) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark #jsbench #jsperf</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>
@lll000111
lll000111 / eslintrc.js
Created April 9, 2018 13:29
eslint configuration
module.exports = {
'root': true,
// eslint recommended defaults can be found in [INSTALL_DIR]/eslint/conf/eslint.json
'extends': [
'eslint:recommended',
"plugin:flowtype/recommended"
],
'parser': 'babel-eslint',
'parserOptions': {
'ecmaVersion': 6,
@lll000111
lll000111 / loginForm.html
Last active February 21, 2018 17:54
fritz.box login dialog
<div id="dialogContent" name="" class="dialog_content">
<form id="loginForm" name="" class="loginForm" method="post" action="">
<div id="" name="" class="formular">
<p id="" name="" class="">Melden Sie sich mit Ihrem Benutzernamen und Ihrem Kennwort an.</p>
<label for="uiViewUser">Benutzername</label>
<select id="uiViewUser" name="uiUser" class="">
<option value="">Bitte wählen ...</option>
<option value="ftpuser">ftpuser</option>
<option value="mha">mha</option>
</select>
@lll000111
lll000111 / gist:423b858d707daf5eba5212ca5e1f6baa
Created August 14, 2017 11:30
Errors from Android Studio
Executing tasks: [:generateDebugSources, :generateDebugAndroidTestSources, :mockableAndroidJar, :prepareDebugUnitTestDependencies]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preDebugAndroidTestBuild UP-TO-DATE
:preDebugUnitTestBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
@lll000111
lll000111 / async-errors-with-stack-demo.js
Last active July 4, 2019 20:42
How to get stacktraces from errors from asynchronous functions (node.js and all browsers - simple)
// @flow
'use strict';
// Needed to create a _really_ asynchronous function. A fake asynchronous function (returning
// "Promise.reject()" right away, for example) actually creates a stacktrace.
const wait = delay => new Promise(resolve => setTimeout(() => resolve(), delay));
// Some deeply nested (in the actual call hierarchy) asynchronous function that throws an error.
const fnError = async () => {
await wait(1);