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
{ | |
"name": "frontend-starter", | |
"version": "1.0.0", | |
"description": "React, browserify and babel. With npm scripts and browser-sync", | |
"main": "index.js", | |
"config": { | |
"ut": "{,!(node_modules)/**/}*.test.js" | |
}, | |
"scripts": { | |
"start": "npm run dev", |
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 map(arr, fn) { | |
var head = arr[0]; | |
var tail = arr.slice(1); | |
if(head === undefined && tail.length === 0) return []; | |
if(tail.length === 0) { | |
return [ fn(head) ]; | |
} | |
return [].concat(fn(head), map(tail, fn)); | |
} |
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 = ([ head, ... tail ], fn) => | |
( (head !== undefined && tail.length) ? ( tail.length ? [ fn(head), ...(map(tail, fn)) ] : [ fn(head) ] ) : []); |
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
{ | |
"name": "library-js", | |
"version": "1.0.0", | |
"description": "Starter for library development with ES6, Babel, Mocha and npm scripts", | |
"main": "./dist/index.js", | |
"scripts": { | |
"start": "npm run dev", | |
"dev": "npm test -- -w", | |
"init": "mkdir dist", | |
"clean": "rm -rf dist", |
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
class MyComponent extends React.Component { | |
partialHandleLinkClick(type, activeType){ | |
return function(e) { | |
const hasKeyboardModifier = e.ctrlKey || e.shiftKey || e.altKey || e.metaKey; | |
updateType(type, activeType, hasKeyboardModifier); | |
}; | |
} | |
render() { | |
const types = [ 'Foo', 'Bar', 'Baz' ]; | |
return ( |
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 mockNode = { | |
get firstChild() { | |
return undefined; | |
} | |
}; | |
const stubFirstChildGetter = sinon.stub().returns(false).onFirstCall().returns(true); | |
sinon.stub(mockNode, 'firstChild') | |
.get(stubFirstChildGetter); |
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 range = (first, last) => { | |
const firstValue = last ? first : 1; | |
const length = last ? last - first + 1 : first; | |
return Array.from({ length }) | |
.map((_, i) => i + firstValue); | |
} |
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
swagger-codegen generate -i <path to your swagger file> -l html2 -o <path to output location> |
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 delimiterRegEx = /(_\w)/g; | |
export function convertSnakeToCamelCase (str) { | |
return str.replace(delimiterRegEx, ([delimiter, firstChar]) => | |
firstChar.toUpperCase() | |
); | |
} | |
export const convertKeysToCamelCase = obj => | |
Object.entries(obj).reduce((prev, [key, value]) => { | |
if (value && typeof value === 'object') { |
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
{ | |
"name": "express-pug-scss-starter", | |
"version": "1.0.0", | |
"description": "Express server rendered app with Pug and SCSS", | |
"main": "server.js", | |
"config": { | |
"app": "server.js", | |
"scss": "./src/scss", | |
"css": "./dist/css", | |
"img_src": "./src/img/", |