If you use atom... download & install the following packages:
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
| var myExports = require("my-library-dependency-i-want-to-see"); | |
| console.log(Object.keys(myExports)); |
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
| export const cacheImages = async (srcArray) => { | |
| const promises = await srcArray.map((src) => { | |
| return new Promise((resolve, reject) => { | |
| const img = new Image(); | |
| img.src = src; | |
| img.onload = resolve(); | |
| img.onerror = reject(); | |
| }); | |
| }); | |
| await Promise.all(promises); |
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
| // Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function) | |
| // Returns a function, that, as long as it continues to be invoked, will not | |
| // be triggered. The function will be called after it stops being called for | |
| // `wait` milliseconds. | |
| const debounce = (func, wait) => { | |
| let timeout; | |
| return function executedFunction(...args) { | |
| const later = () => { |
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 DynamicComponent:React.FC = ({ ComponentName, ...props}) => <ComponentName {...props} /> |
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
| // https://www.trysmudford.com/blog/linear-interpolation/ | |
| // ^ fantastic guide from here!! | |
| const lerp = (x, y, a) => x * (1 - a) + y * a; | |
| const invlerp = (a, b, v) => clamp((v - a) / (b - a)) | |
| const clamp = (v, min = 0, max = 1) => Math.min(max, Math.max(min, v)); | |
| const items = [{ | |
| scrollStart: 70, // Scroll tracking start point | |
| scrollEnd: 120, // Scroll tracking end point |
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
| @mixin breakpoint($minWidth) { | |
| @media screen and (min-width: $minWidth) { | |
| @content; | |
| } | |
| } | |
| // @include breakpoint(650px) { width: 50%; } | |
| // etc.. |
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
| return( | |
| <select name="years" id="years"> | |
| { [...Array(40).keys()].map( (i, k) => i > 0 && <option key={ k } value={ i + 1 } selected={ parseInt(value, 10) === ( i + 1 ) }>{ i + 1 } years</option> ) } | |
| </select> | |
| ); |
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
| // Polyfill | |
| if (typeof window !== 'undefined') { | |
| require('intersection-observer'); // eslint-disable-line global-require | |
| } | |
| // when elements intersect add css class | |
| export default ({ | |
| elements, | |
| threshold, | |
| root = null, | |
| rootMargin = '0px', |
These rules are adopted from the AngularJS commit conventions.
NewerOlder