It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
This file contains hidden or 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 _confidence(ups, downs) { | |
var n = ups + downs; | |
if(n === 0) { | |
return 0; | |
} | |
var z = 1.281551565545; | |
var p = parseFloat(ups) / n; | |
var left = p + 1 / (2 * n) * z * z; |
This file contains hidden or 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
const Compose = ({ children = () => null, ...chain }) => { | |
const composedFn = Object.entries(chain).reduce( | |
(acc, [renderProp, renderFn]) => props => | |
renderFn(value => acc({ ...props, [renderProp]: value })), | |
children | |
); | |
return composedFn(); | |
}; |
This file contains hidden or 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
Moved to https://github.com/ebidel/puppeteer-examples |
This file contains hidden or 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
// I'm suggesting we add a new "adopt X from <Y />" syntax to the JSX language | |
// it would de-sugar to render prop children, but look and read better than | |
// what we currently have. For example: | |
// 1. | |
// this sugar | |
function MyComponent(props) { | |
adopt foo from <Bar />; | |
return <div>{foo}</div>; | |
} |
This file contains hidden or 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
const puppetteer = require("puppeteer"); | |
/** | |
* @param {string} pageUrl The URL that you want to gather coverage data for | |
*/ | |
const unusedCode = async pageUrl => { | |
const browser = await puppetteer.launch(); | |
console.log("browser launched"); | |
const page = await browser.newPage(); | |
console.log("new page created"); |
caution do not use package.json
for the folder name if you want to clone this project to your machine - it will break yarn
(An unexpected error occurred: "EISDIR: illegal operation on a directory, read".
).
Original version of this document copied from yarnpkg.
See also npm documentation, std-pkg, clean-publish, package-json-validator, cosmiconfig, rc (as an opponent approach to cosmiconfig).
This file contains hidden or 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
/** | |
* Copyright 2018 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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 MaybeN(value) { | |
if (value.__type__ === "maybe") { | |
return value; | |
} | |
const isEmpty = () => value === undefined || value === null; | |
let internalMaybe = {}; | |
internalMaybe = { |