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 assert = (...args) => { | |
this.args = args | |
return { | |
equals: (arg) => { | |
console.log(`${this.args.join(' + ')} = ${arg}`) | |
return this.args | |
} | |
} | |
return this; |
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
/** | |
Throw uncaught errors to the next middleware automatically | |
and avoid having to use try/catch in the controller methods | |
router.get('/', asyncRequest(controller.index)); | |
with asyncRequest... | |
index: async(req, res) => { | |
const data = await Model.findAll(); |
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 default (context, inject) => { | |
const dialog = { | |
open: (options) => { | |
window.$nuxt.$emit('dialog', { ...options, open: true }); | |
}, | |
close: (options) => { | |
window.$nuxt.$emit('dialog', { ...options, open: false }); | |
} | |
}; | |
inject('dialog', dialog); |
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
.button { | |
padding: 2px; | |
background: none; | |
border-radius: 2px; | |
cursor: pointer; | |
text-align: center; | |
&--confirm { | |
padding: 8px 8px 6px 8px; | |
border: none; |
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
<template> | |
<div> | |
<button class="button button--confirm" @click="openDialog">Open Dialog</button> | |
<DialogModal /> | |
</div> | |
</template> | |
<script> | |
export default { | |
methods: { |
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
<template> | |
<transition name="fade"> | |
<div v-if="open" class="modal-backdrop"> | |
<div class="modal"> | |
<div class="modal-body"> | |
<p>{{ message }}</p> | |
</div> | |
<div class="modal-footer"> | |
<button class="button button--confirm" @click.stop="confirm">Confirm</button> | |
<button class="button button--cancel" @click.stop="cancel">Cancel</button> |
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
<template> | |
<transition name="fade"> | |
<div v-if="open" class="modal-backdrop"> | |
<div class="modal"> | |
<div class="modal-body"> | |
<p>{{ message }}</p> | |
</div> | |
<div class="modal-footer"> | |
<button class="button button--confirm" @click.stop="confirm">Confirm</button> | |
<button class="button button--cancel" @click.stop="cancel">Cancel</button> |
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
// This is ugly | |
// const Service = require('../app/services/Service'); | |
// Try this instead | |
// const Service = alias('service/Service') | |
const path = require('path'); | |
const aliases = { | |
config: './config', |
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
# Install dependencies | |
echo "Installing dependencies" | |
npm install --prefix ./client && npm install --prefix ./server && npm install | |
# Copy the .env.example to .env | |
cd server | |
if [ ! -f .env ]; then | |
echo "\nCreating the .env file" | |
cp -v .env.example .env |
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
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// choose either `'stable'` for receiving highly polished, | |
// or `'canary'` for less polished but more frequent updates | |
activeTab: '🚀', | |
NewerOlder