Split a single file into multiple files under a directory name based on the original.
Maintain git history.
Create a file names.txt
that contains one line for each of the files that are the targets of the split.
git branch -r | grep -v "origin/master$" | tr -d "[:blank:]" | tr "\n" "\0" | xargs -0 git branch -d -r |
/** | |
* Creates a new "outer" async function with the same signature as the given `promiseFactoryFn`. | |
* | |
* When the outer function is invoked the `promiseFactoryFn` is passed the same arguments and must return a Promise or | |
* array thereof. | |
* | |
* When all promises complete the `callback` is invoked with the duration of each, in milliseconds. The result of the | |
* promises is returned from the outer function. | |
*/ | |
export const promiseAllWithTiming = <T: $ReadOnlyArray<mixed>, U: mixed>( |
const walk = (text) => (v) => { | |
if (Array.isArray(v)) { | |
return walk(text)({ groups: v }); | |
} else { | |
const { label, path, gzipSize, groups } = v; | |
if (label && label.includes(text)) { | |
return [{label, path, gzipSize}]; | |
} else if (groups && groups.length) { | |
return groups.map(walk(text)).reduce((r, v) => r.concat(v), []); | |
} else { |
const { basename } = require('path'); | |
const { ConcatSource } = require('webpack-sources'); | |
const ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers'); | |
/** | |
* Loosely based on wrapper-webpack-plugin | |
* https://www.npmjs.com/package/wrapper-webpack-plugin | |
* | |
* Chunk deletion based on webpack-remove-empty-js-chunks-plugin |
const { relative } = require('path'); | |
module.exports = babel => { | |
const { | |
types: { | |
stringLiteral, | |
callExpression, | |
identifier, | |
isMemberExpression, | |
isCallExpression, |
/** | |
* Simple custom template literal that removes comments and whitespace in regex | |
*/ | |
const regex = ({ raw }, ...substitutions) => | |
new RegExp( | |
String.raw( | |
{ raw: raw.map(v => v.replace(/\s+#.*$/gm, '').replace(/[\s\r\n]+/g, '')) }, | |
...substitutions, | |
), | |
); |
/** | |
* Give all permutations of the values of the given arrays. | |
* | |
* Each given array implies at least on column in the output. Array elements are spread to create multiple columns. | |
* This may yeild variable length elements in the final output. | |
*/ | |
const permute = (...arrays) => | |
arrays.reduceRight( | |
(previous, array) => | |
array.reduce( |
type NonMaybe<T> = $ObjMap<T, <U>(param: U) => $NonMaybeType<U>>; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.container { | |
display: flex; | |
flex-direction: row; |