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
<div id="root"> | |
<style type="text/css" scoped> | |
h1 { z-index: 10; font-family: 'Roboto', 'Helvetica', sans-serif; display: inline-block; } | |
.loader { | |
margin: 10% auto; | |
font-size: 10px; | |
position: relative; | |
text-indent: -9999em; | |
border-top: 1.1em solid rgba(100, 100, 100, 0.2); |
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, { PropTypes } from 'react'; | |
import { Provider } from 'react-redux'; // Or something else, if you're not using Redux | |
import Router from 'react-router/lib/Router'; | |
const Root = ({ store, history, routes }) => ( | |
<Provider store={store} key="provider"> | |
<Router history={history} routes={routes} /> | |
</Provider> | |
); |
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
// This example would cause an error by ESLint because we are using ES6 JS (it would suggest `const` or `let`) | |
… | |
/* eslint-disable */ | |
var x = 1; | |
… | |
/* eslint-enable */ | |
… | |
var y = 2; // throws eslint-error suggestioning to use `const` or `let` | |
… |
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
const isEmpty = value => value === undefined || value === null || value === ''; | |
const join = (rules) => (value, data) => rules.map(rule => rule(value, data)).filter(error => !!error)[0 /* first error */ ]; | |
export function email(value) { | |
// Let's not start a debate on email regex. This is just for an example app! | |
if (!isEmpty(value) && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)) { | |
return 'Invalid email address'; | |
} | |
} |
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
/** | |
* For demonstration purposes only. Normally this promise would | |
* do something cool, like fetch data from a remote API. | |
* | |
* @param entity | |
* @returns {Promise} | |
*/ | |
function fakePromise() { | |
return new Promise(resolve => { | |
const delay = _getShortDelay(); |
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
// Selects id's inside of an HTML tag that has a space before it. | |
` id="[^"]+"` | |
// Select `headings"` inside of an HTML tag that has a double quote after it, without a space or hyphen before it. | |
// Used to grab the class name headings in this case | |
`(?<! )+(?<!-)+(?=headings")\w+([headings"])` |
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
// | |
// Colors | |
// | |
$color-black: #000; | |
$color-licorice: #111; | |
$color-raisin-black: #222; | |
$color-jet: #333; | |
$color-arsenic: #444; | |
$color-davy-gray: #555; | |
$color-granite-gray: #666; |
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
// Color names generated by: | |
// 1. https://coolors.co/ | |
// 2. http://chir.ag/projects/name-that-color/ | |
// Colors ========================================= | |
// ====== Generic | |
// | |
// Black -> Grays w/ #'s | |
// | |
@color-black : #000000; |
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() { | |
var PHI, backgroundPositionYCache, calculateBaselineYRatio, calculateTextHighestY, calculateTypeMetrics, clearCanvas, containerIdAttrName, containsAnyNonInlineElements, containsInvalidElements, countParentContainers, destroy, fontAvailable, getBackgroundColor, getBackgroundColorNode, getFirstAvailableFont, getLinkColor, getUnderlineBackgroundPositionY, hasValidLinkContent, init, initLink, initLinkOnHover, isTransparent, isUnderlined, linkAlwysAttrName, linkBgPosAttrName, linkColorAttrName, linkContainers, linkHoverAttrName, linkLargeAttrName, linkSmallAttrName, performanceTimes, renderStyles, selectionColor, sortContainersForCSSPrecendence, styleNode, time, uniqueLinkContainerID; | |
window.SmartUnderline = { | |
init: function() {}, | |
destroy: function() {} | |
}; | |
if (!(window['getComputedStyle'] && document.documentElement.getAttribute)) { | |
return; |
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 getRatio(a, b) { | |
return Math.min(a, b) / Math.max(a, b); | |
}; |