Skip to content

Instantly share code, notes, and snippets.

{
"appKey": "randomKey",
"authHost": "https://corestaging.croudcontrol.com",
"authEndpoint": "/broadcasting/auth",
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "localhost",
"options": {
@BrockReece
BrockReece / analytics.js
Created April 15, 2017 17:33
Vue form analytics mixin
import { mapActions } from 'vuex'
export default {
methods: {
...mapActions([
'updateInputFocus',
]),
lastInputFocus(e) {
if (!e.srcElement.name) return
@BrockReece
BrockReece / launch.json
Last active September 18, 2017 13:36
Chrome debugging in Visual Studio Code
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Remote debugging",
"sourceMaps": true,
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}"
@BrockReece
BrockReece / App.vue
Created September 18, 2017 13:45
Vue debugger example
<template>
<div>{{ hello }}</div>
</template>
<script>
export default {
data() {
return {
hello: 'Hello',
}
<template>
<div class="a" v-html="content"></div>
</template>
<script>
export default {
data() {
return {
content: 'this is a <a class="b">Test</a>',
}
@BrockReece
BrockReece / LazyLoad.vue
Last active January 31, 2018 21:06
Lazy Load HOC
<template>
<div v-if="outOfView" class="placeholder">&nbsp;</div>
<div v-else>
<slot></slot>
</div>
</template>
<script>
export default {
props: {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.intersectionRatio > 0) {
observer.disconnect()
this.showComments = true
}
})
}, this.options)
observer.observe(this.$refs.ending)
@BrockReece
BrockReece / HandlingPromises.js
Last active February 1, 2018 17:08
Promises vs AsyncAwait
export default {
methods: {
// better for readability
async veryReadable() {
const { data } = await axios.get(`https://jsonplaceholder.typicode.com/post/${response.data[0]}/comments?_page=1`)
this.comments = data
},
// better for returning a promise for chaining
returningPromise() {
<template>
<div v-if="outOfView" class="placeholder">&nbsp;</div>
<div v-else>
<slot></slot>
</div>
</template>
Vue.config.performance = true