🌴
- GitHub Staff
- https://josh.black
- @josh.black
- @__joshblack
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 styles = {} | |
| styles.base = { | |
| width: '150px', | |
| height: '150px', | |
| background: 'mediumorchid', | |
| transition: '0.35s all ease-in-out' | |
| }; | |
| styles.circle = { |
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 fill(amount, item) { | |
| const a = Array(amount), | |
| i = j = 0; | |
| for (i; i < amount; i++) { | |
| a[j++] = item; | |
| } | |
| return a; | |
| } |
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 measure(target, name, descriptor) { | |
| const fn = descriptor.value; | |
| descriptor.value = async function () { | |
| const mark = `mark_${name}`; | |
| performance.mark(mark); | |
| const result = await fn(); | |
| performance.measure(mark); | |
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 particle() { | |
| const node = document.createElement('div'); | |
| node.style.position = 'absolute'; | |
| return document.body.appendChild(node); | |
| } | |
| function position(particle, pv) { | |
| const { translate } = transform, | |
| p = pv.map((p) => px(p)); |
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
| // particle | |
| // particle() -> DOM node | |
| function particle() { | |
| const node = document.createElement('div'); | |
| node.style.background = 'black'; | |
| node.style.position = 'absolute'; | |
| node.style.width = px(50); | |
| node.style.height = px(50); |
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 transform = { | |
| translate(x, y) { | |
| return transformFunction('translate', x, y); | |
| } | |
| } | |
| function transformFunction(property, ...values) { | |
| return `${property}(${values.join(', ')})`; | |
| } |
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 transform = { | |
| translate(x, y) { | |
| return transformFunction('translate', x, y); | |
| } | |
| } | |
| function transformFunction(property, ...values) { | |
| return `${property}(${values.join(', ')})`; | |
| } |
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 logger(target, name, descriptor) { | |
| const fn = descriptor.value; | |
| descriptor.value = function (...args) { | |
| console.log(`Calling ${name} with:\n${args.join('\n')}`); | |
| console.log(args); | |
| const result = fn.apply(target, args); | |
| console.log(`Result:\n${result}`); |
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 Radium from 'radium'; | |
| import { PropTypes } from 'react'; | |
| export default class Image { | |
| static propTypes = { | |
| src: PropTypes.string.isRequired, | |
| alt: PropTypes.string.isRequired | |
| } | |
| render() { |
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
| { | |
| isJSXAttribute: [Function], | |
| assertJSXAttribute: [Function], | |
| isJSXClosingElement: [Function], | |
| assertJSXClosingElement: [Function], | |
| isJSXElement: [Function], | |
| assertJSXElement: [Function], | |
| isJSXEmptyExpression: [Function], | |
| assertJSXEmptyExpression: [Function], | |
| isJSXExpressionContainer: [Function], |