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
var element = document.getElementById('fruits-template'); | |
element.parentNode.removeChild(element); | |
var template = element.innerHTML; | |
var component = new Vue({ | |
el: '#fruits', | |
template: template, | |
data: { | |
fruits: ['Apple', 'Mango', 'Banana'] | |
} |
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
var component = new Vue({ | |
el: '#fruits', | |
template: '#fruits-template', | |
data: { | |
fruits: ['Apple', 'Mango', 'Banana'] | |
} | |
}); |
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
<div id="fruits"> | |
<ul> | |
<li v-for="fruit in fruits">{{fruit}}</li> | |
</ul> | |
</div> | |
<script> | |
var component = new Vue({ | |
el: '#fruits', | |
data: { |
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
var persistentStore = { | |
state: JSON.parse(localStorage.getItem('persistent-state')), | |
save () { | |
localStorage.setItem('persistent-state', JSON.stringify(this.state)); | |
} | |
}; |
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
var store = { | |
counter: 0, | |
addOne () { | |
this.counter ++; | |
} | |
}; | |
var componentA = new Vue({ | |
data: { | |
counter: store.counter |
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
input CreateFruitInput { | |
name: String! | |
} | |
type Mutation { | |
createFruit(input: CreateFruitInput!): Fruit | |
} |
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
type Query { | |
singleFruit(id: ID!): Fruit | |
allFruits: [Fruit] | |
} |
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
type Fruit { | |
id: ID! | |
name: String! | |
} |
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 admin = require("firebase-admin"); | |
const serviceAccount = require("./service-account.json"); | |
if (admin.apps.length === 0) { | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: "https://XXXXX.firebaseio.com" | |
}); | |
} |
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 dgram = require('dgram'); | |
const message = new Buffer('Server?'); | |
const socket = dgram.createSocket('udp4'); | |
socket.on('listening', function () { | |
socket.setBroadcast(true); | |
setInterval(() => { | |
socket.send(message, 0, message.length, 5555, '255.255.255.255'); | |
}, 5000); | |
}); |