Skip to content

Instantly share code, notes, and snippets.

View morphatic's full-sized avatar
♨️
brewing...

Morgan Benton morphatic

♨️
brewing...
View GitHub Profile
@morphatic
morphatic / webpack.config.js
Created April 23, 2020 08:03
Configuring Webpack for use with Vuetify in TrilonIO/aspnetcore-Vue-starter
const path = require('path')
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const bundleOutputDir = './wwwroot/dist'
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = () => {
console.log('Building for \x1b[33m%s\x1b[0m', process.env.NODE_ENV)
@morphatic
morphatic / merge.sh
Created September 11, 2019 02:52
Output of merging dev to master
➜ v-address-fields git:(dev) $ git status
On branch dev
Your branch is up to date with 'origin/dev'.
nothing to commit, working tree clean
➜ v-address-fields git:(dev) $ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
➜ v-address-fields git:(master) $ git status
@morphatic
morphatic / VStateSelect.spec.ts
Created September 11, 2019 00:14
Tests for custom properties of VStateSelect
it('should render component and match snapshot', () => {
const wrapper = mountFunction()
// replace the auto-generated `id` with one that matches
const html = wrapper.html().replace(/div id="input-\d+"/, 'div id="input-1"')
expect(html).toMatchSnapshot()
})
it('should have a property called `contiguousOnly` that defaults to `false`', () => {
const wrapper = mountFunction()
expect(wrapper.vm.contiguousOnly).toBeDefined()
@morphatic
morphatic / VStateSelect.ts
Created September 11, 2019 00:12
Adding custom properties to VStateSelect
// Create Base Mixins and Define Custom Properties
const base = Vue.extend({ mixins: [VAutocomplete] })
interface options extends InstanceType<typeof base> {
/**
* !Props unique to VStateSelect
*/
contiguousOnly: boolean
exclude: string[]
includeTerritories: boolean
}
@morphatic
morphatic / VStateSelect.ts
Created September 10, 2019 23:18
Updating the parent component of VStateSelect
/**
* Import the Vuetify components you plan to extend here.
*/
// @ts-ignore
import { VAutocomplete } from 'vuetify/lib'
// Create Base Mixins and Define Custom Properties
const base = Vue.extend({ mixins: [VAutocomplete] })
interface options extends InstanceType<typeof base> {
/**
@morphatic
morphatic / index.ts
Created September 10, 2019 18:25
The main source file for a custom Vuetify component extension
import { VueConstructor } from 'vue'
import VStateSelect from './VStateSelect'
const VAddressFields = {
install (Vue: VueConstructor, options?: any) {
Vue.component('v-state-select', VStateSelect)
},
}
export { VStateSelect }
@morphatic
morphatic / README.md
Created September 10, 2019 18:21
README.md file for VAddressFields Vuetify sample extension project
@morphatic
morphatic / package.json
Last active September 10, 2019 16:17
Scripts section of package.json for morphatic/v-stripe-elements
{
"scripts": {
"build": "concurrently \"yarn build:dist --no-progress\" \"yarn build:lib\" -n \"dist,lib\" --kill-others-on-fail -r",
"build:dist": "rimraf dist && cross-env NODE_ENV=production webpack --config build/dist.js --progress",
"build:lib": "node build/lib.js",
"commit": "git-cz",
"coverage": "cat ./coverage/lcov.info | coveralls",
"dev": "cross-env NODE_ENV=development webpack-dev-server --config build/dev.js --hot",
"lint": "concurrently -n \"tsc,tslint,eslint\" --kill-others-on-fail \"tsc --noEmit --pretty\" \"tslint -p . src/**/*.ts -t verbose\" \"eslint --ext .js,.ts src\"",
"lint:fix": "concurrently -n \"tsc,tslint,eslint\" \"tsc --noEmit --pretty\" \"tslint --fix -p . src/**/*.ts -t verbose\" \"eslint --fix --ext .js,.ts src\"",
@morphatic
morphatic / index.js
Created May 4, 2017 01:22
Example of polling a REST API every 1.5 seconds with Observables in NodeJS
/**
* Instructions
*
* 1. mkdir test
* 2. cd test
* 3. npm init
* 4. accept all defaults is fine
* 5. npm install @akanass/rx-http-request
* 6. paste code below into new file index.js
* 7. update username, password, other variables
/**
* Instructions
*
* 1. mkdir deploymonitor
* 2. cd deploymonitor
* 3. npm init
* 4. accept all defaults is fine
* 5. npm install @akanass/rx-http-request
* 6. paste code below into new file index.js
* 7. update username, password, other variables