Skip to content

Instantly share code, notes, and snippets.

View trueadm's full-sized avatar

Dominic Gannaway trueadm

View GitHub Profile
function __$createComponent() {
...
}
class MyComponent extends React.Component {
render(props) {
return [props.className, 0, props.items.length, __$createComponent]
}
_bytecode = [
Object.defineProperty(HTMLInputElement.prototype, 'autofocus', {
get() {
return this._autofocus || false;
},
set(x) {
this._autofocus = x;
setTimeout(() => {
this.focus();
}, 0);
return x;
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"use strict";
class Example1 {
constructor() {
this.counter = 0;
this.settings = {
countTimes: 1000,
};
//
const randomValue = false;
'use strict'
var Benchmark = require('benchmark')
var suite = new Benchmark.Suite;
function createList() {
return [1, 2, 3, [[4]], [[[5]]], [6], [[7]]];
}
function flattenRecursive (list) {
// imagine if:
function MyComponent(props, state, update) {
return <div>{ props.foo }</div>;
}
// compiled to:
let MyComponent;
/**
* React v16.0.0-alpha.3
*
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
/**
* ReactDOMFiber v16.0.0-alpha.3
*
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
// spec, both interfaces are lightweight objects that should be creatable in workers and on the main thread
createVirtualElement(
tagName: string,
ref?: Function,
key?: string, // or should it accept key like ES2015 Map keys do?
): VirtualElement
createVirtualTextNode(
text: string,
ref?: Function,
function clickButton({ setState, state }) {
setState({
counter: state.counter != null ? state.counter + 1 || 0
})
}
function StatefulComponent(props, state, setState) {
return <button onClick={ linkEvent({ setState, state }, clickButton) }>Number is { state.counter || 0 }</button>
}