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
import babel from 'rollup-plugin-babel'; | |
import resolve from 'rollup-plugin-node-resolve'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
import builtins from 'rollup-plugin-node-builtins'; | |
import globals from 'rollup-plugin-node-globals'; | |
export default { | |
name: 'GuruSlateTools', | |
input: 'src/index.js', | |
output: { |
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
literallyAMillionObjects.forEach(object => { | |
// uh-oh object 515,253 has no data for some reason :x | |
const { reallyImportantProperty, } = object.data; | |
// More mission critical code that will get you fired if it doesn't run | |
}) |
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
<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
xmlns:w="urn:schemas-microsoft-com:office:word" | |
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" | |
xmlns="http://www.w3.org/TR/REC-html40"> | |
<head> | |
<meta name=Title content=""> | |
<meta name=Keywords content=""> | |
<meta http-equiv=Content-Type content="text/html; charset=utf-8"> | |
<meta name=ProgId content=Word.Document> |
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 init(userConfig) { | |
const DEFAULT_CONFIG = { | |
removeSpaces: false, | |
allowHighlighting: true, | |
priority: "high", | |
} | |
const config = { ...DEFAULT_CONFIG, ...userConfig }; | |
} |
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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
/* This hook is just a simple cache for computing initial state */ | |
function useOnce(func) { | |
const used = React.useRef("NOT_USED"); | |
if (used.current === "NOT_USED") { | |
used.current = func(); | |
} |
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 double(x) { | |
if (!Number.isFinite(x)) { | |
throw `double(x): ${x} is not a number`; | |
} | |
return x * 2 | |
} | |
// We don't have to be aware anymore! | |
function doublePlusOne(x) { |
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
import double from "./double"; | |
function doublePlusOne(x, opts) { | |
// Can't forget to pipe our "opts" through! | |
const doubled = double(x, opts); | |
// We must of received an error. | |
if (!Number.isNumber(doubled)) { return null; } | |
return doubled + 1; |
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
import double from "./double"; | |
// How were we supposed to know we get a second argument | |
// that has an onError function? | |
function doublePlusOne(x) { | |
// if double isn't a number, it will return a string! | |
return double(x) + 1; | |
} |
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 double(x, opts) { | |
if (!Number.isFinite(x)) { | |
const error = `double(x): ${x} is not a number`; | |
if (opts.onError) { | |
return opts.onError(error) | |
} | |
return console.error(error) | |
} |
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 double(x) { | |
if (!Number.isFinite(x)) { | |
return console.error( | |
`double(x): ${x} is not a number` | |
) | |
} | |
return x * 2 | |
} |
OlderNewer