Skip to content

Instantly share code, notes, and snippets.


Eric Ferraiuolo ericf

View GitHub Profile
import time
class Bucket(object):
def __init__(self, max_amount, refill_time, refill_amount):
self.max_amount = max_amount
self.refill_time = refill_time
self.refill_amount = refill_amount
def _refill_count(self):
View FluxStateIterator.js
function reducer(state, action) {
switch (action.type) {
return state + 1;
return state - 1;
summerwind / moz_first_paint.js
Last active Apr 27, 2016
FirstPaintTime for Firefox
View moz_first_paint.js
var firstPaint = 0, firstPaintTime, paint;
function paintHandler() {
paint =
if (firstPaint === 0) {
firstPaint = paint;
firstPaintTime = firstPaint + window.performance.timing.navigationStart;
window.performance.timing.firstPaint = firstPaint;
window.performance.timing.firstPaintTime = firstPaintTime;
gaearon / combining.js
Created Jun 3, 2015
Combining Stateless Stores
View combining.js
// ------------
// counterStore.js
// ------------
import {
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
jlongster / forms-with-react.js
Last active May 8, 2017
higher-order form components w/react
View forms-with-react.js
// Simple wrapper to use bootstrap's grid system to position elements side-by-side
var VerticalFieldsElement = React.createClass({
render: function() {
return dom.div(
{ className: 'clearfix' },, function(child) {
if(!child) {
return child;
steveluscher / gist:4b54e08aa1e0536b7cb9
Last active Apr 30, 2021
Proposed abbreviation API for Intl.NumberFormat
View gist:4b54e08aa1e0536b7cb9



new Intl.NumberFormat([locales[, options]])[, locales[, options]])


View gist:598fa75e22bdfa44cf47

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

View browserify_for_webpack_users.markdown

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

View router.js
"use strict";
var _ = SM.import('lodash');
var DOM = SM.import('sm-dom');
var Uri = SM.import('sm-uri');
// WebKit (as of version 538.35.8) fires a useless popstate event after every
// page load, even when the page wasn't popped off the HTML5 history stack. We
// only want to handle popstate events that result from a page actually being
// popped off the HTML5 history stack, so we need a way to differentiate between
caridy / export-syntax.js
Last active May 4, 2021
ES6 Module Syntax Table
View export-syntax.js
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}