made with esnextbin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (modules, global) { | |
var cache = {}, require = function (id) { | |
var module = cache[id]; | |
if (!module) { | |
module = cache[id] = {}; | |
var exports = module.exports = {}; | |
modules[id].call(exports, require, module, exports, global); | |
} | |
return module.exports; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following code patches google.maps API since in `onRemove` they don't check for null | |
// sometimes this conflicts with the way React handle DOM. | |
const PATCH_ONREMOVE = Symbol.for('Patch onRemove'); | |
function waitForGoogleThenPatch() { | |
/* global google */ | |
if (typeof google === 'undefined') { | |
window.requestAnimationFrame(waitForGoogleThenPatch); | |
} else { | |
const Marker = google.maps.Marker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Foo = require('../Foo'); | |
const React = require('react'); | |
import { mount } from 'enzyme'; | |
import { mountToJson } from 'enzyme-to-json'; | |
describe('Foo', () => { | |
it('simulate a change event using enzyme', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(file, api) { | |
var j = api.jscodeshift; | |
var root = j(file.source); | |
root.find(j.Identifier).forEach(function(p) { | |
if(p.value.name === 'Class') { | |
if(p.parentPath.name === 'init'){ | |
var classDefinition = p.parentPath.value.arguments[0]; | |
var varname = p.parentPath.parentPath; | |
var name = varname.value.id; | |
var target = varname.parentPath.parentPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var big = require('decimal.js'); | |
var denominator = new big(2); | |
var num = new big(1); | |
document.body.innerHTML = (num.dividedBy(denominator.toPower(2048)).toString()); |
made with esnextbin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var twister = require('mersenne-twister') | |
var generator = new twister(); | |
function rand(max, modifier) { | |
modifier = modifier || 0; | |
var rnd = generator.random_incl(); | |
return modifier + 1 + Math.round(rnd * max); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var immutable = require('immutable') | |
var set = immutable.Set.of('a','b','c') | |
console.log( | |
set.reduce(function(result, prop){ | |
result['property' + this.index++] = prop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint browser: true, indent: 2 */ | |
var Delayed = (function (delay) { | |
/*! Andrea Giammarchi - Mit Style License */ | |
// https://gist.github.com/WebReflection/7286687 | |
'use strict'; | |
// method shared across all delayed wrappers | |
function clear() { |
NewerOlder