- Application has tree structure with folders for each "feature"
- Feature folders are named with lowerCamelCase → myComponentDashboard
- Feature can contain any number of components and nested features
- Components are named using UpperCamelCase → MyWidgetComponent.vue
- Component can have translation .yml file named correspondingly → MyWidgetComponent.yml
- If component requires more than 2 files: .vue and .yml file - folder is created with the same name → MyWidgetComponent
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
// | |
// Bundles everything *except* dependencies/builtins | |
// npm install webpack-configify builtin-modules | |
// | |
const builder = require('webpack-configify').default | |
const builtins = require('builtin-modules') | |
const PROD = process.env.NODE_ENV == 'production' | |
const DEPS = Object.keys(require('./package').dependencies || {}) |
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
/** | |
* Example : | |
* var a = [2,7,9]; | |
* binaryInsert(8, a); | |
* | |
* It will output a = [2,7,8,9] | |
* | |
*/ | |
function binaryInsert(value, array, startVal, endVal){ |
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 webpack = require('webpack'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var nodeModules = {}; | |
fs.readdirSync('node_modules') | |
.filter(function(x) { | |
return ['.bin'].indexOf(x) === -1; | |
}) | |
.forEach(function(mod) { |
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 fn = (fn, {required = []}) => (params = {}) => { | |
const missing = required.filter(param => !(param in params)); | |
if (missing.length) { | |
throw new Error(`${ fn.name }() Missing required parameter(s): | |
${ missing.join(', ') }`); | |
} | |
return fn(params); | |
}; |
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
/* | |
http://stackoverflow.com/questions/4915462/how-should-i-do-floating-point-comparison | |
*/ | |
var EPSILON = 0.000001; | |
function fp_less_than(A, B, Epsilon) { | |
Epsilon = Epsilon || EPSILON; | |
return (A - B < Epsilon) && (Math.abs(A - B) > Epsilon); | |
}; |
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 | |
// Local ip address that we're trying to calculate | |
address | |
// Provides a few basic operating-system related utility functions (built-in) | |
,os = require('os') | |
// Network interfaces | |
,ifaces = os.networkInterfaces(); | |
// Iterate over interfaces ... |
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
import { format } from 'url'; | |
import { STATUS_CODES } from 'http'; | |
import uppercamelcase from 'uppercamelcase'; | |
class HTTPError extends Error { | |
constructor(code, message, extras) { | |
super(message || STATUS_CODES[code]); | |
if (arguments.length >= 3 && extras) { | |
Object.assign(this, extras); | |
} |
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
/* | |
Two things will happen here: | |
1) normalize()ing to NFD Unicode normal form decomposes combined graphemes into the combination of simple ones. The è of Crème ends up expressed as e + ̀. | |
2) Using a regex character class to match the U+0300 → U+036F range, it is now trivial to globally get rid of the diacritics, which the Unicode standard conveniently groups as the Combining Diacritical Marks Unicode block. | |
*/ | |
export const normalizeChar = char => char.normalize('NFD').replace(/[\u0300-\u036f]/g, '') | |
export const normalizeStr = str => str.split('').map(normalizeChar).join('') |
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
// Prop/Method Decorator with no arguments | |
function logDecorator(t, n, descriptor) { | |
const original = descriptor.value; | |
if (typeof original === 'function') { | |
descriptor.value = function(...args) { | |
console.log(`Arguments: ${args}`); | |
try { | |
const result = original.apply(this, args); | |
console.log(`Result: ${result}`); | |
return result; |
OlderNewer