Skip to content

Instantly share code, notes, and snippets.

View afontcu's full-sized avatar
🚴‍♂️
¯\_(ツ)_/¯ ‏‏‎

Adrià Fontcuberta afontcu

🚴‍♂️
¯\_(ツ)_/¯ ‏‏‎
View GitHub Profile
@afontcu
afontcu / Media.vue
Last active July 7, 2017 19:02
Media.vue 1
<template>
<div class="o-media">
<div class="o-media__img">
<img v-bind="{ src, alt }" />
</div>
<div class="o-media__body">
<slot></slot>
</div>
</div>
</template>
/* ==========================================================================
MEDIA OBJECT
========================================================================== */
// Fix temporal fins que les variables es mapegin via props
$global-spacing-unit: 1em;
$global-spacing-unit-tiny: $global-spacing-unit / 1.5;
$global-spacing-unit-small: $global-spacing-unit / 1.25;
$global-spacing-unit-large: $global-spacing-unit * 1.25;
$global-spacing-unit-huge: $global-spacing-unit * 1.5;
@afontcu
afontcu / store.js
Last active September 16, 2017 13:59
import createPersistedState from 'vuex-persistedstate'
const store = new Vuex.Store({
strict: process.env.NODE_ENV !== 'production',
actions,
getters,
mutations,
modules,
plugins: [
createPersistedState({
@afontcu
afontcu / store.js
Last active September 17, 2017 16:17
import initialState from '../initialState.json'
sessionStorage.setItem('KEY_DE_LA_SESSIO', JSON.stringify(initialState))
@afontcu
afontcu / router.js
Last active September 16, 2017 22:20
const Home = () => import(/* webpackChunkName: "home-cat" */ './Home')
const Category = () => import(/* webpackChunkName: "home-cat" */ './Category')
const Experience = () => import(/* webpackChunkName: "experience" */ './Experience')
{
"plugins": [
["transform-runtime"],
["component", {
"libraryName": "element-ui"
}]
]
}
<template>
<div v-lazy:background-image="image" class="c-lazy-background">
<slot></slot>
</div>
</template>
<script>
import Vue from 'vue'
import VueLazyload from 'vue-lazyload'
@afontcu
afontcu / resultats.md
Last active September 20, 2017 15:33
PAS 0 PAS 1 PAS 2 PAS 3 PAS 4 PAS 5
Pantalla "Loading" 6,8 5,5 4,3 3,8 2,6 1,14
Pantalla contingut amb significat 9 7,8 6,4 5,3 4,8 6,91
First Paint 1,7 1,6 1,6 1,6 1,6 1,12
First Interactive 21,7 7,28 6,9 4,97 4,97 6,6
Perceptual Speed Index 9170 8835 8464 6805 6805 6450
Pes inicial 3,6MB 1,0MB 924KB 944KB 944KB 1,30MB
Peticions 79 48 49 45 45 52
@afontcu
afontcu / js6-1.js
Last active September 29, 2017 11:30
list
.filter((element, index, array) => element.amount > 10)
.map((element, index, array) => element.time / 60)
.reduce((accumulator, currentValue, currentIndex, array) => accumulator + currentValue)
// el mateix sense paràmetres inútils:
list
.filter(element => element.amount > 10)
.map(element => element.time / 60)
.reduce((accumulator, currentValue) => accumulator + currentValue)
let total = 0
for (let i = 0; i < list.length; i++) {
if (list[i].amount > 10) {
let convertedTime = list[i].time / 60
total += convertedTime
}
}