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
const fs = require('fs') | |
const path = require('path') | |
const data = fs.readFileSync(path.join(__dirname, 'input.txt'), 'utf-8') | |
const rows = data.split('\n').filter(r => r !== '') | |
const matrix = rows.map(row => { | |
return row.split('').map(cell => { | |
if (cell === '.') { | |
return '.' | |
} |
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' | |
new Vue({ | |
el: '#app', | |
data(){ | |
return { | |
vueMessage: 'Message from Vue' | |
} | |
} | |
}) |
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
// SidebarPlugin/index.js | |
const SidebarStore = { | |
// other code, | |
linksStore: [], | |
addSidebarLink(link) { | |
this.linksStore.push(link) | |
}, | |
removeSidebarLink(link) { | |
const index = this.sidebarLinks.indexOf(link) | |
this.linksStore.splice(index, 1) |
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
// Dropdown.vue (parent) | |
<template> | |
<div> | |
<button @click="showMenu = !showMenu">Click me</button> | |
<dropdown-menu v-if="showMenu" :items="items"></dropdown-menu> | |
</div> | |
<template> | |
<script> | |
export default { |
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> | |
<div class="hello"> | |
<div>Name: {{product.name}}</div> | |
<div>Price: {{product.price}}</div> | |
<div>Stock: {{product.stock}}</div> | |
<button @click="addToCart" :disabled="product.stock <= 0">Add to card</button> | |
</div> | |
</template> |
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> | |
<div> | |
<input placeholder="Email" type="email" v-model="form.email"/> | |
<input placeholder="Name" v-model="form.name"/> | |
<button @click="onSave">Save</button> | |
<button @click="onCancel">Save</button> | |
</div> | |
</template> | |
<script> | |
export default { |
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
// Parent | |
<template> | |
<div> | |
<span> Email {{user.email}}</span> | |
<span> Name {{user.name}}</span> | |
<user-form :user="user" @submit="updateUser"/> | |
</div> | |
</template> | |
<script> |
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
// Dropdown.vue (parent) | |
<template> | |
<div> | |
<button @click="showMenu = !showMenu">Click me</button> | |
<dropdown-menu v-if="showMenu" :items="items" @select-option="onOptionSelected"></dropdown-menu> | |
</div> | |
<template> | |
<script> | |
export default { |
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
// Dropdown.vue (parent) | |
<template> | |
<div> | |
<button @click="showMenu = !showMenu">Click me</button> | |
<transition name="fade"> | |
<dropdown-menu v-if="showMenu" :items="items"></dropdown-menu> | |
</dropdown-menu> | |
</div> | |
<template> |
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> | |
<Product :product="product" @add-to-cart="addProductToCart(product)"></Product> | |
</template> | |
<script> | |
import Product from "./components/Product"; | |
export default { | |
name: "App", | |
components: { |
NewerOlder