Skip to content

Instantly share code, notes, and snippets.

View darkwing's full-sized avatar

David Walsh darkwing

View GitHub Profile
const result = await Promise.race([
new Promise((resolve, reject) => {
setTimeout(() => resolve('result!'), 2000);
}),
new Promise((resolve, reject) => {
setTimeout(() => reject('booo!'), 1000);
})
]);
console.log("result is: ", result);
console.log('[routes.component.js] componentDidUpdate ---------------------------');
const keyz = Object.keys(this.props);
keyz.forEach((key) => {
if (this.props[key] !== prevProps[key]) {
console.warn('[prop value inequality]: ', key, this.props[key], prevProps[key]);
}
});
scripts:core:dev:standardEntryPoints: [SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'] {
line: 1,
column: 1,
annotated: '\n' +
'/Users/davidwalsh/Projects/metamask-extension/node_modules/three/src/loaders/TextureLoader.js:1\n' +
"import { ImageLoader } from './ImageLoader.js';\n" +
'^\n' +
"ParseError: 'import' and 'export' may appear only with 'sourceType: module'",
stream: Labeled {
_readableState: ReadableState {
This file has been truncated, but you can view the full file.
{
"invalidCustomNetwork": {
"state": "CLOSED",
"networkName": ""
},
"unconnectedAccount": {
"state": "CLOSED"
},
"activeTab": {},
"metamask": {

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@darkwing
darkwing / keybase.md
Created December 6, 2019 23:57
keybase.md

Keybase proof

I hereby claim:

  • I am darkwing on github.
  • I am davidwalsh (https://keybase.io/davidwalsh) on keybase.
  • I have a public key ASBLmc9ZRCsuaSj2i3Lb14HekUhk0bmuV2f4j8TGPG5Otgo

To claim this, I am signing this object:

@darkwing
darkwing / selectLocation.md
Last active March 26, 2018 15:30
Mo selectLocation mo problems

Fixing selectLocation Madness

At present the selectLocation method is trying to do too much, specifically because the auto-pretty-print logic is a bit weak:

if (
  prefs.autoPrettyPrint &&
  !getPrettySource(getState(), sourceId) &&
  shouldPrettyPrint(selectedSource) &&
 isMinified(selectedSource)
@darkwing
darkwing / emptylines.md
Last active November 6, 2017 17:36 — forked from bomsy/emptylines.md
How do we use babel: Empty Lines

The Firefox debugger has undergone a massive rewrite in the last two years, moving away from old Mozilla-specific technologies like XUL etc, to more modern technologies like React, webpack and babel.

[Babel][babel] is a tool for compiling Javascript into Javascript. It generates an [Abstract Syntax Tree (AST)][ast_wiki] which can be transformed, transversed or manipulated in various ways for use. Babel and AST's have played a major part in growth of the modern web tooling ecosystem.

Over the past year, we have used babel extensively in building the debugger, from disabling non-executable lines so breakpoints cannot be set to highlighting out of scope code and much more.

I felt it would be cool to write a couple of blog posts, documenting some of our coolest use cases and looking into some debugger internals as we go.

package Bugzilla::Extension::PhabBugz::WebService;
use 5.10.1;
use strict;
use warnings;
use base qw(Bugzilla::WebService);
use Bugzilla::Attachment;
Internal Errors
==============================
Response {
status: 500, // HTTP Code
data: {
error: "Internal error: {description of error}. This error has been logged and the team will address the problem shortly.",
}
}
Bugzilla