- use only named exports
- omit class constructor
- don't use fucking
for (;;)
loops
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 renameMaskType = { | |
name: 'fillPaths', | |
type: 'visitor', | |
fn: () => { | |
return { | |
element: { | |
enter: node => { | |
if (node.name === 'path') { | |
node.attributes.fill = '#fff'; | |
} |
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
// @flow | |
import * as React from 'react'; | |
import ResizeObserverPolyfill from 'resize-observer-polyfill'; | |
import invariant from 'tiny-invariant'; | |
const useLayoutEffect = (React: any).useLayoutEffect; | |
const useEffect = (React: any).useEffect; | |
type Rect = {| |
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 template = (code, options, state) => ` | |
// @flow | |
// Generated from ${state.filePath} | |
import * as React from "react"; | |
type Props = { | |
size?: string | number, | |
fill?: string | |
}; |
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 _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
import compose from './compose'; | |
/** | |
* Creates a store enhancer that applies middleware to the dispatch method | |
* of the Redux store. This is handy for a variety of tasks, such as expressing | |
* asynchronous actions in a concise manner, or logging every action payload. | |
* | |
* See `redux-thunk` package as an example of the Redux middleware. |
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 postcss = require('postcss'); | |
const plugin1 = postcss.plugin('test', () => { | |
return css => { | |
css.walkDecls(decl => { | |
if (decl.value === '10px') { | |
decl.cloneAfter({ | |
value: '20px' | |
}); | |
} |
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 map = {}; | |
var list = []; | |
function timeStart(label) { | |
if (!map[label]) { | |
list.push(label); | |
map[label] = { | |
time: 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 template(txt, data) { | |
var key; | |
for(key in data) if(data.hasOwnProperty(key)) { | |
txt = txt.replace(new RegExp('\\{\\{\\s*' + key + '\\s*\\}\\}', 'g'), data[key]); | |
} | |
} |
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
gulp.task('sprite', function (done) { | |
return gulp.src('app/sprite/**/[^_]*.svg') | |
.pipe(rename({prefix: 'shape-'})) | |
.pipe(svgmin()) | |
.on('error', done) | |
.pipe(svgstore({ | |
inlineSvg: true | |
})) | |
.on('error', done) |