Skip to content

Instantly share code, notes, and snippets.

Pier Bover PierBover

Block or report user

Report or block PierBover

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.js
const https = require('https');
const fs = require('fs');
const writeStream = fs.createWriteStream("./log.xls");
let bytes = 0;
https.get('https://edge.mixlr.com/channel/udesp', (resp) => {
resp.on('data', (buffer) => {
bytes += buffer.length;
});
View thing.html
<div id="my-thing-template">
<div class="my-thing" @click='edit'>
<div v-if="!editing">{{thing}}</div>
<div v-else>
<form @submit.prevent="onSubmit">
<input type="text" v-model="form.title">
<button type="submit">Submit</button>
<button @click="cancelEdit">Cancel</button>
</form>
</div>
View fruit.html
<div id="fruits">
<my-fruit v-for="fruit in fruits" :fruit-name="fruit"></my-fruit>
</div>
<script>
var component = new Vue({
el: '#fruits',
data: {
fruits: ['Apple', 'Banana', 'Mango']
}
View fruit.js
<div id="fruit-template" class="vue-template">
<div class="fruit">
<h3>{{fruitName}}</h3>
</div>
</div>
<script>
Vue.component('my-fruit', {
template: '#fruit-template',
props: ['fruit-name']
View fruit.js
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']
}
View fruit.js
var component = new Vue({
el: '#fruits',
template: '#fruits-template',
data: {
fruits: ['Apple', 'Mango', 'Banana']
}
});
View fruit.js
<div id="fruits">
<ul>
<li v-for="fruit in fruits">{{fruit}}</li>
</ul>
</div>
<script>
var component = new Vue({
el: '#fruits',
data: {
View store.js
var persistentStore = {
state: JSON.parse(localStorage.getItem('persistent-state')),
save () {
localStorage.setItem('persistent-state', JSON.stringify(this.state));
}
};
View store.js
var store = {
counter: 0,
addOne () {
this.counter ++;
}
};
var componentA = new Vue({
data: {
counter: store.counter
You can’t perform that action at this time.