This file contains 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
/** | |
* Returns a string representing the truthy/falsy value of the given value. Defaults to "Yes" or "No". | |
* @param {*} value The value to determine the truthy/falsy value of. | |
* @param {String} truthyString The string to use if the value is truthy. | |
* @param {String} falsyString The string to use if the value is falsy. | |
* @example {{ userSelected | boolean }} | |
* @example {{ userSelected | boolean('Included', 'Not Included') }} | |
*/ | |
const booleanFilter = (value, truthyString, falsyString) => | |
value |
This file contains 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 timing = store => next => action => { | |
performance.mark(`${action.type}_start`); | |
let result = next(action); | |
performance.mark(`${action.type}_end`); | |
performance.measure( | |
`${action.type}`, | |
`${action.type}_start`, | |
`${action.type}_end` | |
); | |
return result; |
This file contains 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
// webpack.config.js | |
module.exports = { | |
mode: process.env.NODE_ENV || 'development', | |
target: 'node', | |
module: { | |
rules: [ | |
{ test: /.js$/, exclude: /node_modules/, use: 'babel-loader' } | |
], | |
}, | |
} |
This file contains 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.reddit.com/r/programming/comments/95nea1/are_you_caught_in_the_trap_of_sales_driven/e3ubcgk/ |
This file contains 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
/** | |
* Generalised back-off function. | |
* @param {Function} unary The unary operator function that returns the next state given the current state (current value and invocation count). | |
* @param {Number} initial The initial value to start the back-off. | |
* @example const multiplyTenBackOff = backOff((current, count) => current * 10); | |
* @example const negativeBackOff = backOff((current, count) => current - 1, 1000); | |
*/ | |
const backOff = (unary, initial = 0) => { | |
let current = initial; | |
let count = 0; |
This file contains 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
mounted () { | |
MapBoxGl.accessToken = 'pk.eyJ1IjoibGxveWRqYXRraW5zb24iLCJhIjoiY2ptdG94NnBkMmdveDNrb2VwMnpuZ2xlbiJ9.P_aB3PF24QZL0uAlNvpDVw'; | |
this.map = new MapBoxGl.Map({ | |
container: this.$refs.map, | |
style: 'mapbox://styles/mapbox/streets-v10', | |
center: [8, 50], | |
zoom: 4, | |
}); | |
this.map.addControl(new MapboxGeocoder({ accessToken: MapBoxGl.accessToken })); |
This file contains 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
'use strict'; | |
// This is a demonstration of writing clean Javascript - by adopting a component based approach. | |
// No jQuery, no poorly structured spaghetti code, composed of single purpose functions, has no hard coded selectors and works in IE10+. | |
// This is written in ES5. If build tools were used I would write this in ES7+. | |
// If Vue.js was used as well then a good chunk of the code wouldn't be necessary (and no need to attach to window). | |
window.passwordConfirmationComponent = { | |
selectors: {}, | |
updatePasswordRuleFeedback: function (validation) { |
This file contains 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 simpleMaterialDesignPalette = [ | |
'#F44336', // Red 500 | |
'#E91E63', // Pink 500 | |
'#9C27B0', // Purple 500 | |
'#673AB7', // Deep Purple 500 | |
'#3F51B5', // Indigo 500 | |
'#2196F3', // Blue 500 | |
'#03A9F4', // Light Blue 500 | |
'#00BCD4', // Cyan 500 | |
'#009688', // Teal 500 |
This file contains 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 closeFn: CloseSlideinFn | |
All destructured elements are unused.ts(6198) | |
Argument of type '({ state, closeFn }: PropsWithChildren<{ closeFn?: CloseSlideinFn; state: TemplateDesignerStoreState; }>) => boolean' is not assignable to parameter of type 'Element | FunctionComponent<{ closeFn?: CloseSlideinFn; state: TemplateDesignerStoreState; }>'. | |
Type '({ state, closeFn }: PropsWithChildren<{ closeFn?: CloseSlideinFn; state: TemplateDesignerStoreState; }>) => boolean' is not assignable to type 'FunctionComponent<{ closeFn?: CloseSlideinFn; state: TemplateDesignerStoreState; }>'. | |
Type 'boolean' is not assignable to type 'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)>) | (new (props: any) => Component<any, any, any>)>'.ts(2345) |