Skip to content

Instantly share code, notes, and snippets.


Heaven NE-SmallTown

Block or report user

Report or block NE-SmallTown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
NE-SmallTown / flux.js
Created May 30, 2019 — forked from acdlite/flux.js
A Redux-like Flux implementation in <75 lines of code
View flux.js
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {
NE-SmallTown /
Created Oct 24, 2018 — forked from bvaughn/
How to use profiling in production mode for react-dom
NE-SmallTown /
Created Oct 24, 2018 — forked from bvaughn/
Interaction tracing with React

Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

This Gist provides some high-level docum

NE-SmallTown /
Created Sep 23, 2018 — forked from yelouafi/
Capturing continuations with Generators

Algebraic Effects in JavaScript part 2 - Capturing continuations with Generators

This is the second part of a series about Algebraic Effects and Handlers.

Note: initially I planned a 3-part series, but since the current post on undelimited continuations ended up taking

NE-SmallTown / delimited-continuations.js
Created Sep 10, 2018 — forked from yelouafi/delimited-continuations.js
delimited continuations using javascript generators
View delimited-continuations.js
// We model the call stack using a linked list of Generators
// Each Generator has a _return field pointing back to its parent
function stepGen(gen, arg) {
const {done, value} =
if(done) {
if(gen._return) {
stepGen(gen._return, value)
NE-SmallTown /
Created May 10, 2018 — forked from gaearon/
A Gentle Introduction to Prepack, Part 1


When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.



None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

NE-SmallTown / bookmarklet
Created Mar 27, 2018 — forked from kentcdodds/bookmarklet
activeElement logger bookmarklet
View bookmarklet
javascript:(function(){if(window._activeElInterval){clearInterval(window._activeElInterval);delete window._activeElInterval;}else{var activeEl;window._activeElInterval=setInterval(function(){var currentActiveEl=document.activeElement;if(currentActiveEl!==activeEl){activeEl=currentActiveEl;console.log(activeEl);}},200);}})();
NE-SmallTown / apache-preconnect-workaround-README
Created Feb 14, 2018 — forked from eqhmcow/apache-preconnect-workaround-README
version 2 of a script to kill apache 1.3 / 2.x prefork httpd processes serving preconnect connections, in an attempt to prevent chrome from causing a DoS against the httpd
View apache-preconnect-workaround-README
script to kill apache 1.3 / 2.x prefork httpd processes serving preconnect connections, in an attempt to prevent chrome from causing a DoS against the httpd
This is version 2 of
The major change is the use of two processes instead of one:
One process makes server-status requests, the other kills idle prefork processes.
This allows the kill script to continue killing idle processes even when Chrome has effectively DoS'd the apache server. When this happens, the check script can't get an updated status response back immediately, but the kill script can hopefully free up a slot by killing some processes. Having an uninterrupted request in the socket queue allows us to get an updated response after killing the Chrome preconnections are killed.
NE-SmallTown / firefoxBackgroundBug.html
Created Jan 22, 2018 — forked from cburgmer/firefoxBackgroundBug.html
Workaround for bug in Firefox when rendering background images in HTML to a canvas
View firefoxBackgroundBug.html
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Test case for bug in Firefox where a background image in a SVG isn't rendered to the canvas unless a workaround is applied</title>
<canvas id="canvas" style="border:1px solid black;" width="200" height="200"></canvas>
<script type="text/javascript">
var canvas = document.getElementById("canvas"),
You can’t perform that action at this time.