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
| /** | |
| * Dynamically and asynchronously load a script on the page. | |
| * Receives a callback for onLoad or onError | |
| * | |
| * @param {string} scriptSrc | |
| * @param {loadScriptCallback} callback | |
| * @param [context=null] | |
| */ | |
| function loadScript(scriptSrc, callback, context) { | |
| if (typeof callback !== 'function') { |
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 decodeQueryStringToObj( qStr ) { | |
| return Object.assign.apply( null, qStr.split( '&' ).map( pair => { | |
| const [ key, val ] = pair.split( '=' ).map( decodeURIComponent ) | |
| return { [key]: val } | |
| } ) ); | |
| } |
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 compose( fn, ...fns ) { | |
| return ( ...args ) => fns.reduce( ( carry, fn ) => fn.call( this, carry ), fn.apply( this, args ) ) | |
| } |
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
| /** | |
| * @param number | |
| * @param roundingFactor | |
| * @return {number} | |
| */ | |
| function roundBy(number, roundingFactor = 10) { | |
| return Math.round(+number * +roundingFactor) / +roundingFactor | |
| } | |
| /** | |
| * Round any number to a given decimal precision. Defaults to 1 point precision. |
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
| import pick from 'lodash-es/pick' | |
| import pickBy from 'lodash-es/pickBy' | |
| import omit from 'lodash-es/omit' | |
| import omitBy from 'lodash-es/omitBy' | |
| import clone from 'lodash-es/clone' | |
| import cloneDeep from 'lodash-es/cloneDeep' | |
| import isArray from 'lodash-es/isArray' | |
| import isEmpty from 'lodash-es/isEmpty' | |
| export default class RichModel { |
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
| #!/usr/bin/env bash | |
| openssl req \ | |
| -newkey rsa:2048 \ | |
| -x509 \ | |
| -nodes \ | |
| -keyout ~/.localhost-ssl/<cert-name>.key \ | |
| -new \ | |
| -out ~/.localhost-ssl/<cert-name>.crt \ | |
| -subj /CN=<server-name> \ |
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 path = require('path') | |
| const webpack = require('webpack') | |
| const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
| const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | |
| const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin') | |
| const extractStyles = new ExtractTextPlugin({ | |
| filename: "css/[name].css" | |
| }) |
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
| export function makeAsyncFn(fn, ctx = null) { | |
| return function asyncFunction() { | |
| const oArgs = arguments | |
| if (typeof fn === "function") { | |
| window.setTimeout(function timeoutFn() { | |
| fn.apply(ctx, oArgs) | |
| }, 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
| import { Store } from "vuex" | |
| export default new Store({ | |
| state: { | |
| models: [], | |
| }, | |
| getters: { | |
| // Caches model references into an object keyed by model id's | |
| modelsById (state) { |
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 { assign, defineProperty, defineProperties } = Object; | |
| function readonlyDescriptor() { | |
| return { configurable: false, writable: false } | |
| } | |
| export class SyntheticEvent { | |
| constructor(type, eventInit = {}) { | |
| // Start by emulating native Event constructor. | |
| if (!type) { |