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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
ul { | |
margin: 0; | |
padding: 0; |
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 cached(fn) { | |
const cache = Object.create(null) | |
return function cachedFn(str) { | |
const hit = cache[str] | |
return hit || (cache[str] = fn(str)) | |
} | |
} |
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 toCapitalize(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1) | |
} | |
function css3(transform, value) { | |
const obj = {} | |
obj[`webKit${toCapitalize(transform)}`] = obj[transform] = value | |
return obj | |
} |
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
// create optimized lookup object for | |
// void elements as listed here: | |
// http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements | |
function createNullObj() { | |
return (Object.create) ? Object.create(null) : {}; | |
} | |
/* |
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
import React from 'react' | |
import Router from 'react-router/BrowserRouter' | |
import Match from 'react-router/Match' | |
import Link from 'react-router/Link' | |
import Redirect from 'react-router/Redirect' | |
// function elementInViewport(el) { | |
// var top = el.offsetTop | |
// var left = el.offsetLeft | |
// var width = el.offsetWidth |
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
import React, { Component, PropTypes } from 'react' | |
//import styles from './style.css' | |
class ComponentName extends Component { | |
// static defaultProps = {} | |
static propTypes = { | |
promises: PropTypes.array.isRequired, | |
children: PropTypes.func.isRequired, | |
} |
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 textHidden(el, x) { | |
var styles = window.getComputedStyle(el) | |
var h = parseFloat(styles.height.replace('px', '')) | |
var lh = styles.lineHeight | |
var fontSize = parseFloat(styles.fontSize.replace('px','')) | |
var text = el.innerText | |
var w = fontSize*0.625 | |
var ws = parseFloat(styles.width.replace('px', ''))/w | |
var lines = h/fontSize | |
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
<snippet> | |
<content><![CDATA[ | |
import React, { Component } from 'react' | |
${1://}import styles from './style.css' | |
class ComponentName extends Component { | |
render() { | |
return ( | |
${2: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
import React from 'react' | |
import { TransitionMotion, spring } from 'react-motion' | |
import Match from 'react-router/Match' | |
const transitionMaps = { | |
} | |
const effect = {stiffness: 160, damping: 24} |
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
import React, {Component} from 'react' | |
export default class DontUpdate extends Component { | |
shouldComponentUpdate(nextProps, nextState) { | |
return false | |
} | |
render() { | |
const { tagName, component, ...other } = this.props | |
const TempComponent = component ? component : (tagName ? tagName : 'div') |