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 Vue from 'vue' | |
import App from './App.vue' | |
import router from './router' | |
import store from './store' | |
import VueMaterial from 'vue-material'; | |
import VeeValidate from 'vee-validate'; | |
import 'vue-material/dist/vue-material.min.css' | |
import 'vue-material/dist/theme/default.css' | |
import { formatDate } from './filters/formatDate'; | |
import { capitalize } from './filters/capitalize'; |
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 * as moment from 'moment'; | |
export const formatDate = (date) => { | |
if (date) { | |
return moment(date).format('YYYY-MM-DD hh:mm A'); | |
} | |
} |
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
export const capitalize = (str) => { | |
if (typeof str == 'string') { | |
if (str == 'realestate') { | |
return 'Real Estate'; | |
} | |
if (str == 'sundayreview') { | |
return 'Sunday Review'; | |
} | |
if (str == 'tmagazine') { | |
return 'T Magazine'; |
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 Vue from 'vue' | |
import Vuex from 'vuex' | |
Vue.use(Vuex) | |
export default new Vuex.Store({ | |
state: { | |
searchResults: [] | |
}, | |
mutations: { | |
setSearchResults(state, payload) { | |
state.searchResults = payload; |
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
<template> | |
<q-layout view="lHh Lpr lFf"> | |
<q-header elevated> | |
<q-toolbar> | |
<q-btn | |
flat | |
dense | |
round | |
@click="leftDrawerOpen = !leftDrawerOpen" | |
aria-label="Menu" |
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 Vue from 'vue' | |
import './styles/quasar.styl' | |
import '@quasar/extras/material-icons/material-icons.css' | |
import { | |
Quasar, | |
QLayout, | |
QHeader, | |
QDrawer, | |
QPageContainer, | |
QPage, |
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
// Before Swift 5.1 Memberwise initializers: | |
// Generated memberwise init: init(title: String, url: URL, readCount: Int) | |
let article = ArticleStruct(title: "", url: URL(string: "")!, readCount: 0) | |
// After Swift 5.1 Memberwise initializers, using the default 0 for read count | |
// Generated memberwise init: init(title: String, url: URL, readCount: Int = 0) | |
let article = ArticleStruct(title: "", url: URL(string: "")!) |
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 articleStruct = ArticleStruct(title: "Struct vs Class", url: URL(string: "www.avanderlee.com")!, readCount: 0) | |
var articleStructCopy = articleStruct | |
articleStruct.readCount = 10 | |
print(articleStructCopy.readCount) // Prints: 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
let articleClass = ArticleClass(title: "Struct vs Class", url: URL(string: "www.avanderlee.com")!) | |
let articleClassCopy = articleClass | |
articleClass.readCount = 10 | |
print(articleClassCopy.readCount) // Prints: 10 |
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
struct ArticleStruct { | |
let title: String | |
let url: URL | |
var readCount: Int = 0 | |
} |